Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maddening MySql question

Status
Not open for further replies.

GiffordS

Programmer
May 31, 2001
194
0
0
CA
Ok, I have been working in PHP for mysql and never encountered this before. Admittedly, this isn't my strongest suit, but still. This is driving me insane. I have created tables and an html form to bring input to the tables via PHP. When I click the submit button the php script is called and executed. No exceptions are thrown, no errors are logged, and nothing is put into the database. The script believe it has inserted the data, because no error was recorded even though it was requested in event of failure. It simply brings back NULL when queried for affected rows. I have manually opened the table and there is indeed nothing there. It doesn't throw the error on connect, selection of database, or selection of table. All of those seem to be fine. Any suggestions?
 
How can we assess your problem without the use of a script? Post the part of your script that is giving you trouble and I am sure we will be able to help you much easier.

Hope this helps.

-Vic vic cherubini
krs-one@cnunited.com
 
Try looking at the query that gets passed to MySQL. If you try to insert empty values (as in INSERT INTO table (field1, field2) VALUES ('', '') )then MySQL won't return an error but it won't insert anything either.

Hope this helps,

Bromrrrr
 
The fields in the MySQL database are set to NOT NULL, which means that you can't insert a '' value into them. Try altering the script to insert a single space as in INSERT INTO table (field1, field2) VALUES (' ', ' ') and see if that works. If it does, then use TRIM() to retrieve the values from the fields to convert any single space (' ') values into a ''.

Alternatively, you could modify the field definitions using the MySQL ALTER TABLE commands to remove the NOT NULL setting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top