note 90625 modified in pdostatement.bindvalue by danbrown
| From: | danbrown@php.net | Date: | Fri, 01 May 2009 19:01:45 +0000 |
| Subject: | note 90625 modified in pdostatement.bindvalue by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154085@lists.php.net to get a copy of this message | ||
If you want to bind a null value to a database field you must use 'NULL' in quotes (for
MySQL):
<?php
$stmt->bindValue(:fieldName, 'NULL');
// not
$stmt->bindValue(:fieldName, NULL);
// or
$stmt->bindValue(:fieldName, null);
?>
Using PHP's null/NULL as a value doesn't work.
--was--
If you want to bind a null value to a database field you must use 'NULL' in quotes (for
MySQL):
$stmt->bindValue(:fieldName, 'NULL');
not
$stmt->bindValue(:fieldName, NULL);
or
$stmt->bindValue(:fieldName, null);
Using PHP's null/NULL as a value doesn't work.
http://php.net/manual/en/pdostatement.bindvalue.php