waynewex Posted November 18, 2008 Share Posted November 18, 2008 Okay, basically, I'm allowing users to insert orders into a database. Problem is, the price variable doesn't seem to end up in the database, even though it is coming through the POST and making its way into the query. The table column amountPaid is set to double. $session_id = session_id(); $data_ok = true; //assumed true unless proven otherwise if (isset($_POST['book']) && $data_ok){ $event = mysql_real_escape_string($_POST['event']); $date = mysql_real_escape_string($_POST['date']); $time = mysql_real_escape_string($_POST['time']); $datetime = $date.' '.$time; $num_children = mysql_real_escape_string($_POST['num_children']); $num_adults = mysql_real_escape_string($_POST['num_adults']); $price = mysql_real_escape_string($_POST['price']); echo $price; $insert = mysql_query(" INSERT INTO Orders (sessionId,eventId,noChildren,noAdults,dateTime,amountPaid) VALUES ('$session_id','$event','$num_children','$num_adults','$datetime',$price)") or die(mysql_error()); } Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted November 18, 2008 Share Posted November 18, 2008 $insert = mysql_query(" INSERT INTO Orders (sessionId,eventId,noChildren,noAdults,dateTime,amountPaid) VALUES ('$session_id','$event','$num_children','$num_adults','$datetime','$price')") or die(mysql_error()); Should work now. You were missing the single quotes around $price in the query. Regards, ACE Quote Link to comment Share on other sites More sharing options...
waynewex Posted November 18, 2008 Author Share Posted November 18, 2008 Sorry, I had removed them when trying to debug. No, I'm just after finding out that the problem doesn't rest in the insert; it rests in the output. Whoops. Thanks anyway. Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted November 18, 2008 Share Posted November 18, 2008 Well your script looks fine. Try adding error_reporting(E_ALL); to the top of the script and see what comes up. Quote Link to comment Share on other sites More sharing options...
waynewex Posted November 18, 2008 Author Share Posted November 18, 2008 It's ok, I found the problem. Basically, the column is called amountpaid and not amountPaid. The programmer before me had kept with the camelback naming convention throughout all of his columns... expect for that one column. Thanks! Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted November 18, 2008 Share Posted November 18, 2008 that certainly explains it then lol. Hit topic solved (bottom left) Quote Link to comment 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.