Re: PEAR::DB getCol default behaviour

From: Date: Mon, 26 Sep 2005 09:32:40 +0000
Subject: Re: PEAR::DB getCol default behaviour
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21103@lists.php.net to get a copy of this message
Jeroen Houben wrote:
Hi, Consider this code: $sql = 'SELECT email FROM vw_event_persons WHERE event_id=!'; $emails = $db->getCol($sql, null, array(23)); I'm trying to skip the 2nd parameter, passing in NULL to leave it at its default value, which is 0. This however raises an error, saying :"field not found". When I pass in 0 like this: $emails = $db->getCol($sql, 0, array(23)); it works fine. I was under the impression that when you pass in NULL, the default parameter value (0) would get passed instead. Is this a bug?
No, if you specify a value for an optional parameter, than that value is used even if you pass in null. regards, Lukas

« previous php.pear.general (#21103) next »