websteve Posted July 20, 2010 Share Posted July 20, 2010 I am having a problem with SQL Insert. All of them work, except the last one (highlighted). If anyone has any idea what is going on, please let me know. Thanks. Code is below: $gen="INSERT INTO general (ID, fname, lname, address, city, state) VALUES ('$cust_id','$fname','$lname','$address','$city','$state')"; mysql_query($gen) or die('Could not connect to general table: ' . mysql_error()); $pur="INSERT INTO Purchasing (ID, Item, Description, Quantity, Price) VALUES ('$cust_id','$item','$descr','$quantity','$price')"; mysql_query($pur)or die('Could not connect to Purchasing table: ' . mysql_error()); $cre="INSERT INTO Credit (ID, Credit_Card_Number, Expiration, Code) VALUES ('$cust_id','$credit_card_number','$expiration','$code')"; mysql_query($cre)or die('Could not connect to Credit table: ' . mysql_error()); $del="INSERT INTO Delivery (ID, Date, Time, AMPM) VALUES ('$cust_id','$date','$time','$ampm')"; mysql_query($del)or die('Could not connect to Delivery table: ' . mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/208242-mysql-insert/ Share on other sites More sharing options...
bh Posted July 20, 2010 Share Posted July 20, 2010 Hi, Is there an error message? -> http://www.phpfreaks.com/forums/index.php/topic,129174.0.html ! Quote Link to comment https://forums.phpfreaks.com/topic/208242-mysql-insert/#findComment-1088462 Share on other sites More sharing options...
websteve Posted July 20, 2010 Author Share Posted July 20, 2010 Nope and I am using mysql_error(). I was told I might need to add the mysql_real_escape_string() to prevent injection attacks for Insert. Is that true? And if so, how would I incorporate it into the syntax? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/208242-mysql-insert/#findComment-1088554 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.