It checks out with no errors, but does nothing to my database.
Heres my query:
mysql_query("INSERT INTO dc_donations (transaction_id,amount,original_request) VALUES (".$randomID.",".(float)$_POST['a开发者_如何学Cmount'].",'demo donation')");
Also, a query below it works perfectly.. So connection is fine.
Is this PHP?
mysql_query("INSERT INTO dc_donations (transaction_id,amount,original_request) VALUES (".$randomID.",".(float)$_POST['amount'].",'demo donation')");
I'd recommend not inserting from the post, but have you tried
echo mysql_error();
? that should be enlightening.
What is the type of your variables? I presume it's int, float and char(n), respectively? Try removing the (float), because it's not necessary in PHP. Also, go with @genesis's suggestion of adding "or die(mysql_error())".
On a side note, make sure you properly escape the $_POST variables.
Try replace your code with (it will give you answer)
mysql_query("INSERT INTO dc_donations (transaction_id,amount,original_request) VALUES (".$randomID.",".(float)$_POST['amount'].",'demo donation')") or die(mysql_error());
精彩评论