insert NULL values
| From: | Nate Tanner | Date: | Tue, 07 Nov 2000 08:12:34 +0000 |
| Subject: | insert NULL values | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-4271@lists.php.net to get a copy of this message | ||
Newbie, looking for the standard way to insert NULL values into a table when
I don't know if the variable is NULL or not (in MySQL). Any help
appreciated.
Is there any difference between this:
INSERT INTO table ( col1 ) VALUES ( NULL );
and
INSERT INTO table ( col1 ) VALUES ( '$someVarThatMayNotHaveAValue' ); ?
If so, I get stuck doing this for every value in the INSERT:
( $val1 ? "'$val1'," : "NULL" ) .
It seems like there should be an better way.
Thanks
Nathaniel Tanner