Forum Moderators: open
Here's some background on my issue:
I've built a web application with a section which accepts job applications. This application "section" is 6 pages long. Before a user can go to the next page, all data from the submitted page is validated so that all required form fields are appropriately filled in. If required information has not been input, the page re-displays with warnings.
When a page HAS been successfully completed, all data from that page is held in php $_Session vars.
When the 6th page is submitted, all $_Session vars that DO contain text input gets processed by the mysql_real_escape_string() function. Those session Vars that are empty get a value of 'NULL'. After that happens, everything gets inserted into the db table.
There's essential functional background. I've tested this application locally with 10 fictitious applicants and on my dev environment, everything worked out okay - everything gets inserted into the proper fields in the proper db table.
Now, the problem:
So, after testing, I put my code and the db live so my client could begin inputting historical applicant data. They just finished inputting 75 applicants, but when I checked the DB, some rows were completely empty - Not many... about 12 out of the 75 entered... but that's enough to freak me out. I'm freaked because - as previously mentioned - you cannot go to the next page without the user providing required input on the preceding page.
Has anyone else had this experience?
I don't know where to start to look. Could it be that I need to use Transactions to make sure everything is submitted correctly from one record before another record is inserted? Another weird thing is that my client told me that he only had one person inputing this data... so it's not like more than one record was being inserted at any one time (at this point).
I'm really confused and nervous about this problem... could someone please give me some advice?
Neophyte
Are you checking the return status of your inserts to see if it returns any type of error status? Might want to log the actual INSERT statement(s) you're executing right before you issues it as well as any errors that might occur to a flat logfile so that you can review later. Could be that one particular field when left blank or answered a particular way causes your INSERT statement that you build to be invalid. Have you tried entering single quotes (') and other special characters, for instance, in your string fields to see if they are being handled correctly before writing to the DB?