Page 1 of 1

Inserting a 'Null' value into my database

Posted: Fri Mar 20, 2009 4:16 pm
by Addos
Hi,
I want to insert a ‘null’ value into my database in certain situations but I’m not having much luck. When I try to use something like

Code: Select all

if(empty($_POST['sheet'])) { $bf = "NULL" ; }
this basically inserts the word NULL into the database and not the italicised one I’d normally see in PHPMyAdmin.

Can anyone point me to what I need to do?
Thanks

Re: Inserting a 'Null' value into my database

Posted: Fri Mar 20, 2009 4:24 pm
by Christopher
You need to use NULL rather than "NULL" and you need to define the column to allow NULL when you create the table. I think NOT NULL is the default.