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

NOT NULL - Not Working

Status
Not open for further replies.

ShamaJamms

Programmer
Mar 28, 2007
11
Somehow, I think the NOT NULL property isn't working. I looked through the Information Schema on a GUI client, and did not see it. I created a MySQL table and set all rows to NOT NULL, yet it will accept null values.

I have created an HTML page that has an Iframe on it, linked to a PHP page. When I refresh the HTML page (and thus the PHP page), it will resend the code to MySQL, creating a blank row (except date, which is automatically entered by a variable with the PHP date() command), even if the HTML forms yield no value. Here is the code:

CREATE TABLE withdraw (
id int NOT NULL auto_increment,
reason varchar(20) NOT NULL,
amount decimal(8,2) NOT NULL,
date varchar(20) NOT NULL,
primary key (id));

 
I think I got it to work. Instead of having the HTML form submit directly to the Iframe, I had it submit to a new page, but used the Iframe to display the results only.
 
You said it submits a blank row. Do you mean empty fields? Those are not the same thing at all as NULLs. Are you passing NULL in the case of a field not filled out or just an empty string ''?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top