Speedysnail6 Posted December 7, 2013 Share Posted December 7, 2013 This is my php code if(mysqli_query($con,"INSERT INTO transactions (ID, Amount, To, From, Description, Type) VALUES ('23', '46', 'hello', 'hello', 'hell1', 'asddsa')")) { return "success"; } echo mysqli_error($con); I get this 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 'To, From, Description, Type) VALUES ('23', '46', 'hello', 'hello', 'hell1', 'asd' at line 1 What am i doing wrong? Link to comment https://forums.phpfreaks.com/topic/284600-mysql-error/ Share on other sites More sharing options...
PravinS Posted December 7, 2013 Share Posted December 7, 2013 To, From are reserved words in MySQL, either you can change the column names or use title (``) character around column names, like `To`,`From` Link to comment https://forums.phpfreaks.com/topic/284600-mysql-error/#findComment-1461554 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.