- Home /
 
 
               Question by 
               BadNewsBears · Feb 08, 2014 at 04:44 AM · 
                c#androidwwwmysql  
              
 
              WWW Form C# on Android
So We're working on a university project where we're required to create a game plus a companion app on Android and/or iOS We have the main game running a log in script to connect to a web server and php files which in turn connect to the MySQL Database however when we use the same script on Android we get an error: Script; using UnityEngine; using System.Collections;
 public class GUIscript : MonoBehaviour {
 
     public string Username = "";
     public string Password = "";
     private string message = "";
 
     public Texture LoginButton;
 
     void OnGUI()
     {
         if (message != "")
         {
             GUI.Box(new Rect(Screen.width / 3f, Screen.height - 20, 300, 50), message);
         }
         
         
         Username = GUI.TextField(new Rect(Screen.width / 3, Screen.height / 2, 350, 30), Username, 40);
         Password = GUI.PasswordField(new Rect(Screen.width / 3, Screen.height / 2 + 50, 350, 30), Password,'*', 40);
 
 
 
         if (GUI.Button(new Rect(Screen.width / 2.3f, Screen.height - 100, 150, 50), LoginButton))
         {
             if(Username == "" | Password == "")
             {
                 message += "Please enter all fields \n";
             }
             else
             {
                 WWWForm form = new WWWForm();
                 form.AddField("Username", Username);
                 form.AddField("Password", Password);
                 WWW w = new WWW("ourURL/login.php", form);
                 StartCoroutine(LoginFunction(w));
                 Debug.Log(UserName);
             }
         }
     }
 
     
     IEnumerator LoginFunction(WWW w)
     {
         yield return w;
         if(w.error == null)
         {
             if (w.text == "login-SUCCESS")
             {
                 SceneController.LoginCorrect = true;
                 Debug.Log("login Successful");
             }
             else
             {
                 message += w.text;
             }
         }
         else
         {
             message += "ERROR: " + w.error + "/n"; 
         }
     }
 
     void Start () {
     
     }
     
     void Update () {
     
     }
 }
 
               And here is the error;
 protocol not found: ourURL/login.php/nERROR: java.net.Malfcm
 
              
               Comment
              
 
               
              It was to replace the URL but the http:// wasn't there. You sir are a life saver!
Your answer
 
             Follow this Question
Related Questions
Multistage Delete with WWW 1 Answer
Live chat using MySQL? 0 Answers
Unity WWW gzip 1 Answer
red question mark loading image as texture with WWW 2 Answers