MySQL Forums
Forum List  »  PHP

Re: 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 'Malajika,Active Church ,2018-07-21,7 Carter,12,12,12,12,12,12,12,12,12,12,12,12' at line 3
Posted by: Peter Brawley
Date: July 17, 2018 11:05AM

First, mysql_functions are deprecated, in fact removed in latest PHP releases. Use mysqli.

Second, never accept $_GET[] or $_POST[] results directly into a database. Run all such input through mysqli_real_escape_string().

Third, string and data literals need to be quoted. To see all the errors your generated Insert query has elicited ...

echo $sql;

... then copy and paste it into the mysql client to find the errors that need fixing.

Options: ReplyQuote


Subject
Written By
Posted
Re: 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 'Malajika,Active Church ,2018-07-21,7 Carter,12,12,12,12,12,12,12,12,12,12,12,12' at line 3
July 17, 2018 11:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.