Hi All, hope someone can help me, I have a basic site which records returns from sales on amazon. I have the mysql table setup correctly, however the php and html code are not working. Here is the code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Sorry about that, first time in the forum and didn't read the posting guidelines as needed a quick answer. I changed the die to mysql_error() and no error pops up now, but it still doesn't add the data to the mysql database. Cheers
If you print out the sql statement just before you execute the query, then you should copy and run this sql statement in phpMyAdmin to check it.
Your sql statement, though, names eight fields but has nine values.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
Sorry my mistake, I changed the die statement for the error statement instead of adding it. The error is "Column count doesn't match value count at row 1". Here is a print screen of the table in phpmyadmin:
As Andrew says, you have specified 8 columnns but supplied 9 values. Thats what your error message is also telling you.
You need to look at your columns and values and work out what you've done wrong. As a temporary measure, delete the 'NOW()' bit from the SQL and see if it then works.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Thanks Andrew/tangoforce. I deleted the NOW() function and it worked. I am not 100% sure why the now statement was stopping it. Could you possibly explain why it was wrong to use the now statement? Thanks
Thanks Andrew/tangoforce. I deleted the NOW() function and it worked. I am not 100% sure why the now statement was stopping it. Could you possibly explain why it was wrong to use the now statement? Thanks
We've already told you.
Your SQL statement was telling mysql to insert data into 8 columns yet you were supplying 9 pieces of data. The mysql NOW() function becomes a time value which counts as a 9th parameter.
Where is mysql supposed to store than when you have not specified a 9th column?
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Thanks for that, for some reason I had it in my mind that the NOW() statement meant it would insert the data Now... Lack of sleep. Thanks for the help anyway.
the NOW() statement meant it would insert the data Now
Well, you made me smile
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
Thanks for that, for some reason I had it in my mind that the NOW() statement meant it would insert the data Now... Lack of sleep. Thanks for the help anyway.
Sadly no, mysql simply thinks that you've supplied more data to be stored in a column. Because you've not told it what column it should go in it will give you an error instead
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.