I wrote this code and I hope that you can tell me what is wrong with it .!

$sql = "INSERT INTO offers (title,description,location,type,status,img,real,username) VALUES('".$title."','".$description."','".$location."','".$type."','".$status."','".$img."','".$real."','".$username."')";
$query = mysql_query($sql) or die(mysql_error());

The 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 'real,username) VALUES('y','qq
','aa','test1','test2','t','test3','core')' at line 1

Recommended Answers

The first and most serious issue is that you are not using prepared statements. The second one is that you are using a reserved word as a field named “real” .
Take a look at

Jump to Post

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.