Interview Question in SQL Server Security
Interview Question :: What is wrong with my mysql syntax (in php)
Table: datadump
Columns: table, column, data
Data I want to insert: They are variables; $table, $column, $data
I know that the mysql_select_db and mysql_connect is ok and I will not give that for security reasons, but what about this syntax:
$sql = "INSERT INTO datadump (table, column, data) VALUES ($table,$column,$data)";
$mysqlquery = mysql_query($sql,$con);
if(!$mysqlquery)
{
die('Error: ' . mysql_error());
}
When I run the script with this syntax, I get the following error:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table, column, data) VALUES (index,name,fruits)' at line 1
Can you please tell me what to do?

Loading ...