Question by
FullHeartGames · Sep 06, 2016 at 02:53 PM ·
databasephpsql
SQL/Php how to send one variable to database - Think it's a syntax error!
My database has been working well until I tried sending only one variable. It seems to me like its a syntax error but I can't seem to find an example using only one variable. Thanks in advance!
I am mostly suspicious of my php
if($_REQUEST['action']=="submit_user_name")
{
$name = $_REQUEST['name'];
$sql = "INSERT INTO user_name (name) VALUE ('$name')";
//mysql_query($query);
$result = mysqli_query($connect, $sql);
}
Here's my Unity code:
WWWForm submitUser = new WWWForm();
submitUser.AddField("action", "submit_user_name");
submitUser.AddField("name", userName);
WWW sendData = new WWW(url, submitUser);
yield return sendData;
if (sendData.error != null)
{
print(sendData.error);
}
yield return sendData;
Debug.Log(sendData.error);
Comment
Answer by doublemax · Sep 06, 2016 at 03:47 PM
$sql = "INSERT INTO user_name (name) VALUE ('$name')";
VALUES (plural, even if you enter only one field)
Your answer
Follow this Question
Related Questions
PHP & SQL on Android 0 Answers
i need help unity get data from php 0 Answers
php $_POST is blank when I send variables from unity 3 Answers
Mono.Data.Sqlite.SqliteException:Unable to open the database file at Mono.Data.Sqlite.SqLite3.Open 0 Answers
Unity sql PHP script can log in with wrong password, what's wrong? 0 Answers