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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

empty posts in PHP / MySql database.

Status
Not open for further replies.

GiffordS

Programmer
May 31, 2001
194
CA
I have a MySql database being used to hold data for a set of web forums. Everything is working fine except for one quirk.

One of my tables contains all original threads. This table has columns for a unique thread id, author, title, body of the post, which forum it belongs in, etc. The id, author, title, body, date, and forum columns are all set to NotNull. This is confirmed in PHPMyAdmin. The issue I have is that I keep getting empty posts in this table. The posts contain a thread id and a date, but all other info is empty. What's worse is that these are not botched or aborted posts! There are no issues with posting a new thread! I've been through my post script at least a dozen times and I still don't see how this could happen. If nothing else, a script error that tried to insert empty posts would cause a MySql error when inserting null fields into author, title, etc. Yet there are no errors. Has anyone seen this before?

 
all the others are strings. If you insert an emprty string is a good value. Empty Strings are different from null values.

Check the INSERT and do not insert rows if there are blank fields Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
No, it's not in the insert. The author field simply could not be blank. It is set automatically from a session variable. The session variable is registered at login and is the log in user name. The is no blank user name in the members table, and entering an invalid or blank user name results in log in failure and no session variable being registered. It is not possible to even REACH the post page unless this variable is registered. In short, the author variable must be set to a valid username to reach the page containing the insert statement. So string or no string, there's no way it's just a blank insert. Any other ideas?
 
what's the code ? Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top