Inserting NULL values does not work
| From: | Andy | Date: | Fri, 01 Feb 2002 15:42:44 +0000 |
| Subject: | Inserting NULL values does not work | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16405@lists.php.net to get a copy of this message | ||
Hi guys,
I am trying to insert a NULL value into a DB field. The value is not always
NULL so the statement is given. Unfortunatelly it is inserting 0 instead of
NULL.
How can I get the thing going with NULL???
Here is the code I am using:
if ($park == 'false'){
$park = NULL;
}
$stmt = "INSERT INTO $T1
(
belongs_to,
name,
caption,
country,
province,
city,
glacier,
park,
lake,
mountain,
beach,
comment,
keywords,
date_taken,
date_posted
)
VALUES
(
'$user_id',
'$picture',
'$caption',
'$country',
'$province',
'$city',
'$glacier',
'$park',
'$lake',
'$mountain',
'$beach',
'$comment',
'$keyword',
'$date_taken',
'$date_posted'
)";
Cheers Andy