Re: DB_DataObject and NULL values

From: Date: Wed, 02 Jul 2003 01:15:22 +0000
Subject: Re: DB_DataObject and NULL values
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17922@lists.php.net to get a copy of this message
Alan Knowles wrote:
Arnaud Limbourg wrote:
hey I've come across a little problem while trying to update a row in the database with a NULL value. what I'm trying to do is basically this: $dbObject->Col1 = null; $dbObject->Col2 = null; $dbObject->update();
The thing is that you are passing the PHP NULL type. What you probably want to do here is $dbObject->Col1 = 'null'; $dbObject->Col2 = 'null'; $dbObject->update(); thus passing a string which the database will interpret in the correct way. Arnaud.
Actually the design was correct, it was supposed to use null as a php value. - it looks like I need to use @is_null($value); tests as isset() return false on null.. Will have a look at it later today hopefully Regards Alan
on my version of php is_null('null') and 'null' === NULL both return true. Using 'null' is sufficient for now but it seems kinda silly. It would be nice if php understood null and unset to be two seperate things. Chris

« previous php.pear.dev (#17922) next »