PHP MySQL script shows no error but won't insert row (more details and
different code)
Ok. So right now, my line of code for inserting looks like this:
$query=mysqli_query($con,"insert into orders values
(".$user_index.",".$order_date.",".$_POST['item_number'].",".$_POST['price'].",".$_POST['tax'].",'".$_POST['pay_method']."')");
$order_date is a date. $user_index and $_POST['item_number'] are INTs.
$_POST['price'] and $_POST['tax'] are doubles. $_POST['pay_method'] is an
enum. At the moment, I really couldn't care less about SQL-injection. I
just want a working page for now. I'll secure it before it goes live on my
website.
My virtual server throws exceptions whether I put in
"die(mysqli_error($con))" or not. However, in this case, it is definitely
reaching the code that's in the same if statement after the insert
statement. Yet, when I run this code, everything looks fine but nothing
has changed in the database.
I have tried:
insert into orders (user_index,order_date,item_number,...) values (...)
but it doesn't work that way either.
Finally, yes, I have asked a similar question before. But as I am new to
this website, didn't know if there was a way to edit my old question, and
figured this would just be easier since I have more details now and I
could possibly get the same people as before to answer this with their
questions and troubleshooting steps answered; I just went ahead and posted
a new question.
No comments:
Post a Comment