timmah1 Posted February 10, 2008 Share Posted February 10, 2008 Here is my code include ('DB_config.php'); $table = 'order'; $ip = $REMOTE_ADDR; $query = mysql_query("INSERT INTO $table (`id` , `date`, `ip`, `f_name`, `l_name`, `email`, `phone`, `address`, `address2`, `city`, `state`, `zip`, `hear`, `objectives`, `preferred`, `f_name2`, `l_name2`, `email2`, `phone2`,`address22`, `address222`, `city2`, `state2`, `zip2`, `quantity`, `card_type`, `ccn`, `exp`, `cw`, `processed`) VALUES ('NULL','NOW()','$ip','".$_POST['f_name']."','".$_POST['l_name']."','".$_POST['email']."','".$_POST['phone']."','".$_POST['address']."','".$_POST['address2']."','".$_POST['city']."','".$_POST['state']."','".$_POST['zip']."','".$_POST['hear']."','".$_POST['objectives']."','".$_POST['preferred']."','".$_POST['f_name2']."','".$_POST['l_name2']."','".$_POST['email2']."','".$_POST['phone2']."','".$_POST['address22']."','".$_POST['address222']."','".$_POST['city2']."','".$_POST['state2']."','".$_POST['zip2']."','".$_POST['quantity']."','".$_POST['card_type']."','".$_POST['ccn']."','".$_POST['exp']."','".$_POST['cw']."','n')") or die("Sorry, there was a problem with your order ".mysql_error()); I keep getting this error Sorry, there was a problem with your order 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 'order (`id` , `date`, `ip`, `f_name`, `l_name`, `email`, `phone`, `address`, `ad' at line 1 Can you please advise as to why?? I have used this code numerous times, different values, but the same code regardless and have never gotten this error. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/90305-error-when-inserting/ Share on other sites More sharing options...
marcus Posted February 10, 2008 Share Posted February 10, 2008 try $table = "order"; $query = "INSERT INTO `".$table."` ..."; Quote Link to comment https://forums.phpfreaks.com/topic/90305-error-when-inserting/#findComment-463058 Share on other sites More sharing options...
timmah1 Posted February 10, 2008 Author Share Posted February 10, 2008 Thank you. It works Quote Link to comment https://forums.phpfreaks.com/topic/90305-error-when-inserting/#findComment-463062 Share on other sites More sharing options...
timmah1 Posted February 10, 2008 Author Share Posted February 10, 2008 Where's the "SOLVED" button? Quote Link to comment https://forums.phpfreaks.com/topic/90305-error-when-inserting/#findComment-463064 Share on other sites More sharing options...
budimir Posted February 10, 2008 Share Posted February 10, 2008 On the top or in the bottom. "TOPIC SOLVED" click on it. Quote Link to comment https://forums.phpfreaks.com/topic/90305-error-when-inserting/#findComment-463208 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.