Hello, quick question about MySQL storing NULL values...
Say I have a textbox called $_POST["text"] and a variable $var.
if(empty($_POST["text"]))
$var = NULL;
else
$var = $_POST["text"];
Disregarding filtering/formatting the data, upon inserting $var into
MySQL, I thought it *should* result in a NULL entry in the database (the
field is setup to accept NULL values). I am sure $var = NULL before
inserting into the table because is_null() returns TRUE.
The field is of type CHAR and the entry gets added simply as ''
(obviously without the quotes). If I run a select statement to find all
entries where field = NULL, I get 0, but where field = '' returns the entry.
I don't understand why it's doing this. The only way I can get it to say
NULL in the record is by actually setting $var = 'NULL', but that to the
best of my knowledge is just setting $var to the CHAR value 'NULL', not
actually NULL.
Thanks in advance for all your help.
Marcus