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()); 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 ! 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. Link to comment https://forums.phpfreaks.com/topic/208242-mysql-insert/#findComment-1088554 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.