Insert NULL row value from PHP in PostgreSQL
| From: | Rouanet Jean-François | Date: | Fri, 22 Dec 2000 15:30:25 +0000 |
| Subject: | Insert NULL row value from PHP in PostgreSQL | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-5417@lists.php.net to get a copy of this message | ||
Hello,
I am trying to insert NULL values in a date row in PostgreSQL from PHP:
For example:
$myid = 1;
$mydate = "NULL";
$query = "insert into test (id, date) values ($myid, $mydate);
works if $mydate is without quotes.
$mydate = "01-01-2000";
$query = "insert into test (id, date) values ($myid, '$mydate');
works in this case if $mydate is with quotes;
What's the correct syntax to use if I want the query to work in all cases?
Thank you for your help and Merry Xmas.
J.F.
*-----------------------------------------------------------------------*
* ROUANET Jean-Francois | INSERM ADR 9 *
* Responsable Regional Informatique | Institut Francois Magendie *
* INSERM AQUITAINE | Rue Camille Saint Saens *
* | 33077 BORDEAUX CEDEX *
* Jean-Francois.Rouanet@bordeaux.inserm.fr | FRANCE *
* | Tel.: (33) 05 57 57 36 50 *
* | 06 87 83 64 12 *
*-----------------------------------------------------------------------*