forumnz Posted May 3, 2009 Share Posted May 3, 2009 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, date, due_date, inv_number, ref, tax_incl) VALUES ('e878dca5c96oa38a815cf915' at line 1 And this is the code: <?php mysql_query("INSERT INTO table (hash_key, inv_key, to, date, due_date, inv_number, ref, tax_incl) VALUES ('$hk', '$ik', '$to', '$date', '$due', '$inv_num', '$ref', '$tax')")or die(mysql_error()); ?> What's wrong with it? Thanks Link to comment https://forums.phpfreaks.com/topic/156621-solved-mysql-error/ Share on other sites More sharing options...
forumnz Posted May 3, 2009 Author Share Posted May 3, 2009 Is to reserved? Link to comment https://forums.phpfreaks.com/topic/156621-solved-mysql-error/#findComment-824697 Share on other sites More sharing options...
DarkSuperHero Posted May 3, 2009 Share Posted May 3, 2009 what are some of the values you are trying to inser...what does $ik, $to, $date look like ? Link to comment https://forums.phpfreaks.com/topic/156621-solved-mysql-error/#findComment-824699 Share on other sites More sharing options...
forumnz Posted May 3, 2009 Author Share Posted May 3, 2009 $ik is an md5 string (so 32 chars long) $to is a text string (eg White House) $date is text with slashes The rest are similar, with $tax being from a list (value might be i or e) What could it be? Link to comment https://forums.phpfreaks.com/topic/156621-solved-mysql-error/#findComment-824701 Share on other sites More sharing options...
DarkSuperHero Posted May 3, 2009 Share Posted May 3, 2009 im sure this wont make much of a diff...but try.... <?php mysql_query("INSERT INTO table (`hash_key`, `inv_key`, `to`, `date`, `due_date`, `inv_number`, `ref`, `tax_incl`) VALUES ('$hk', '$ik', '$to', '$date', '$due', '$inv_num', '$ref', '$tax')") or die(mysql_error()); ?> and your sure that your the table is named table, and it has the columns named: hash_key, inv_key, to, date, due_date, inv_number, ref, tax_incl ? Link to comment https://forums.phpfreaks.com/topic/156621-solved-mysql-error/#findComment-824703 Share on other sites More sharing options...
forumnz Posted May 3, 2009 Author Share Posted May 3, 2009 No way! I didn't think that would work either.. but it did! Thanks heaps DarkSuperHero!! Sam Link to comment https://forums.phpfreaks.com/topic/156621-solved-mysql-error/#findComment-824704 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.