mytable in mysql
create table mytable
(
id int,
topic,
startdate datetime default NULL)
)
A user can submit a form without filling out a value for the startdate.
I am using a function to pull out a NULL, the NULL value in PHP, however, shows nothing, so I cannot use it directly in mysql
function testfornull($tst){
if($tst=='')return NULL;
return $tst;
}
-- > function returns ''" in case of a NULL
In the case of a NULL value, my sql statement should look like this
insert into mytable(id,topic,startdate) values('some topic',NULL)
How should I go about with this?( I cannot put NULL between quotes, it will error in mysql)