I'm working on something with Unity3d MySQL Db. I am passing values through $_GET
PHP method but I'm having trouble with strings with white spaces when I store them into the assigned tables.
Let's say I have an InputField which gets the string I need. Then, I pass the string through the $_GET
method, like this:
public InputField myInput;
public string a;
void StoreData()
{
a = myInput.text;
StartCoroutine(store(a));
}
IEnumerator store(string str)
{
WWW connection = new WWW("http://localhost/route/store_company.php?name=" + str);
yield return(connection);
}
So, after connecting to the DB, in the php file I have:
$name = $_GET['name'];
$query = "INSERT INTO company(id, name) VALUES (NULL, '$name')";
$get_query = mysqli_query($connection, $query);
echo '101';
If I type "Example" in the InputField, the VARCHAR column called name will have "Example". But if I type "This is an example", the VARCHAR column just stores the first word ("This") missing the rest of the sentence.
I've sat the VARCHAR to 70 (Length). Pretty new using MySQL. ¿How I capture the whole sentence and why don't work if I am passing a string variable?