So i'm using MySQL and C# in order to grab info from a database, but when i try to use that database info again in MySQL doesn't work because it seems to be adding a small space in front of the data. Let me show you what i mean.
php code that displays info on webpage
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$nick = $_POST["myform_nick"];
$sql = "SELECT Lin FROM scores WHERE name='$nick'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo $row["Lin"];
}
}
Then in C# it is like this...
IEnumerator LeagueCheck(){
var form = new WWWForm ();
form.AddField( "myform_nick", formNick );
WWW w = new WWW (URL, form);
yield return w;
if (w.error != null) {
print(w.error); //if there is an error, tell us
}
else {
print("League Check 1");
LinII = w.text; //here we return the data our PHP told us
print (w.text);
Lin = LinI + LinII;
w.Dispose(); //clear our form in game
StartCoroutine (LeagueCheck2 ());
}
}
Inside LeagueCheck2 it uses LinII to grab another thing from the database but it can't find it because it comes back like this
" Dominators"
instead of like this
"Dominators"
So my question is how can i get it to remove that little space in front of Dominators.
What i've tried to fix this
using System;
LinII = String.Trim(w.text);
LinII = w.text;
LinII.Trim();
LinII.Replace(" ","");
void Timer(){
LinII.Trim();
}
//In the IEnumator LeagueCheck();
Lin = LinI + LinII;
w.Dispose(); //clear our form in game
Trimer();
StartCoroutine (LeagueCheck2 ());