By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,442 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,442 IT Pros & Developers. It's quick & easy.

"Column 'Name' cannot be null"

P: n/a
Hi All, I create a form for the user to enter the information, the
form contains two table, table A and table B. I wrote a script to
prompt the user to fill all the necessary data if they miss to fill in
one column. The problem I met now is once I fill the data of first
table and leave the second data blank, an error occured to prompt the
user to fill the second table and return to main page again, after I
clicked ok and error message displayed "Column 'Name' cannot be null"
and the information I entered previously was stored into the database.
If I key in the information again, the data is duplicate in the
database. How to avoid that? Thanks
Best Regards,
Hau Jyn
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Here's a hint: don't ever add data to a data-base, when its not absolutly
correct/complete, because there's no ensurence, that the user will add the
missing data.

if( **ALL DATA INPUT CORRECT (nothing is blank)** ){

This should work correctly, without doublicated data.

To avoid that the user has to re-enter data, that has already been entered
once, you could use the $_REQUEST variables and the VALUE properties of
<input ...> and <textarea>...</textarea> (whatever).

It's been used like this:

echo '<input type="text" name="D_NAME" value="'.$_REQUEST["D_NAME"].'">';
echo '<textarea name="D_TEXT">'.$_REQUEST["D_TEXT"].'</textarea>';
// D_NAME and D_TEXT could be anything (must be a valid name).
So, when the user forgets to enter some data, he will be asked to fill out
the form again, BUT the data he/she previously entered will be in the form,
already, so he/she only has to add the data he/she forgot.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.