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? Quote Link to comment 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` Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.