scotch33 Posted January 31, 2007 Share Posted January 31, 2007 Hi,I am getting this - 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 'invoiceno='123456', amount='23.00', name='test', email='[email protected]', phone=' at line 3when using the following code - [code] $sql_insert = "INSERT INTO payment_records SETrand_code='$randcode'invoiceno='$invoiceno',amount='$amount',name='$name',email='$email',phone='$phone',companyname='$companyname',billingaddress='$billingaddress',billingpostcode='$billingpostcode',addresschange='$addresschange'";[/code]apparently the version of mysql has recently been upgraded to 4.3.10 - I have tried to find refernce to any difference in comands but haven't had a lot of luck. Can anyone point me in the right direction? Link to comment https://forums.phpfreaks.com/topic/36482-sql-syntax-error/ Share on other sites More sharing options...
webren Posted January 31, 2007 Share Posted January 31, 2007 Try using...[code]$sql_insert = "insert into payment_records values('$randcode', '$invoiceno', '$amount', $name', $email', $phone', $companyname', $billingaddress', '$billingpostcode', $addresschange'";[/code]...if you're placing the values into all of the table columns. If you're not placing the values into all of the columns in your table, then you need to specify which colums to insert by...[code]$sql_insert = "insert into payment_records(columns go here) values('$randcode', '$invoiceno', '$amount', $name', $email', $phone', $companyname', $billingaddress', '$billingpostcode', $addresschange')";[/code] Link to comment https://forums.phpfreaks.com/topic/36482-sql-syntax-error/#findComment-173646 Share on other sites More sharing options...
paul2463 Posted January 31, 2007 Share Posted January 31, 2007 you are missing a comma after rand_code='$randcode' Link to comment https://forums.phpfreaks.com/topic/36482-sql-syntax-error/#findComment-173649 Share on other sites More sharing options...
scotch33 Posted January 31, 2007 Author Share Posted January 31, 2007 Doh! Thanks guys! Link to comment https://forums.phpfreaks.com/topic/36482-sql-syntax-error/#findComment-173678 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.