INSERT INTO query problem, site launches < 24 hrs!! Help!
Hello,
I can't see a problem in this script but I keep getting insert query failed errors. Here it is, let me know if you see anything wrong, certain items are marked with ****** for security reasons:
Go to http://www.nancygoldmanart.com and type in an e-mail address and hit submit in order to see the error. Any help is greatly appreciated. This site launches in about 24 hours! Thanks!
A handy addition to the mysql : query or die(error message) is the php mysql_error function http://uk2.php.net/mysql_error
mysql_query($query) or die('Error, insert query failed <br />'.mysql_error());
Obviously don't do this on a live site as any error messages are a rich source of clues to design flaws/hacking opportunities.
Here is my new code, I am not getting an error which makes sense cuz i took it out, i am just getting a blank page and the contents of the form still arent being added to the database. I tried mysql_error() and it did not return anything.
any ideas?
It is likely an error with your database connection as your code seems to be correct. When connecting to the database and inserting into the database, add the mysql_error() function to see what error it gives you.
I resolved the problem, it was a problem in my database, I had an id column which for some reason was set default to 0 and it was the primary key, every time I would try to make an entry, it wouldn't make it because it would be a duplicate id. I took out the id column and set the email column as the primary key.....problem solved! Thanks for the help!
Bookmarks