How do i search a mysql database in unity 5

Hi All,

how do i search for a Row using mysql using a public string im new to mysql and php

---------------- php script-----------------------------
<?PHP

		$servername = "localhost";
		$username = "root";
		$password = "";
		$dbName   = "online_pw_build";
		
		 $CurrentUser = "currentuser";
		
		
		$conn = new mysqli($servername, $username, $password, $dbName);
		
		
		if(!$conn)  {
			
			die("connection failed". mysqli_connect_error());
		}
		
		$sql = "SELECT Onwer FROM db_toons";

$check = mysql_query("SELECT * FROM `db_toons` WHERE `Onwer` LIKE 'currentuser'");

{
	die ("Username does not exist 

");
}

{
	$CurrentUser = (currentuser);
	while($row = mysql_fetch_assoc($check))
	{
		if (currentuser == $row['Onwer'])
			 echo "ID:".$row['ID'] . "|Onwer:".$row['Onwer']. "|Toonone:".$row['Toonone']. ";";
		
	}
}

?>

-------------C# script----------------

using UnityEngine;
using System.Collections;

public class CurToon : MonoBehaviour {
	
	public string  currentuser;

	IEnumerator Start(){
		WWW CurToon = new WWW("http://localhost/online_pw_build/CurToon.php");
		yield return CurToon;
		string CurToonrString = CurToon.text;
		print (CurToonrString);
}

what i want to happen a user login to a database ID Onwer toonone toontwo this part is done

after they login i want to search for the Onwer they logged in with then return that row back to unity

ok so instead of doing echo use the die funciton. this will stop the page at this message. also use the trim function as sometimes you get a whitespace at the beginning. if not just remove it. Putting the ‘–’ acts a form of key for us to know when to split the string. You can use anything!

 die(ltrim($row["ID"] . "--" . $row["Owner"] . "--" . $row["Toonone"]));

Next, in your script in unity change your IEnumerator to this:

void Start() {
			WWWForm form = new WWWForm();
                    // add as many of these as you need. you will use the $_POST variable funciton in your php file.
                    // so in your PHP file wyou will have $owner = $_POST['the field name']; and it will equal whatever the "variable name" 's value is.
			form.AddField("the field name", variable name);
			string link = "link to your PHP file";
			Debug.Log(link);
			WWW curToon = new WWW(link, form);
			StartCoroutine(GetInfo(curToon ));
		}
	}

IEnumerator GetInfo(WWW curToon) {

		string infoString;

		yield return curToon;
		infoString = curToonw.text.ToString().TrimStart();

		if (infoString == "0") {
			Debug.Log ("no player info..");
		} else {
		
			Debug.Log(infoString);
			string[] infoArray = infoString.Split(new[] { "--" }, System.StringSplitOptions.None);

	
		string playerID = infoArray [0];
		string playerName = infoArray [1];
		string playerToonone = infoArray [2];


		Debug.Log ("id: " + playerID);
		Debug.Log ("owner: " + playerName);
		Debug.Log ("Toonone: " + playerToonone );


		}
	}

There is probably an easier way to do it. I did it this way though and it works just fine.