note 28419 deleted from function.extract by sniper

From: Date: Sun, 13 Jul 2003 01:58:15 +0000
Subject: note 28419 deleted from function.extract by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-52003@lists.php.net to get a copy of this message
Note Submitter: jasonmercer@yahoo.com ---- One quick amendment to the IFNULL suggestion for MySQL: use of aliases is highly recommended, because most flavors of MySQL will not return the base field name in the associative array but rather the entire function name itself. Therefore, the better MySQL query should read: $SQL = "SELECT IFNULL(field1,'n.a.') as field1 FROM table" which will create an associate array with key 'field1' and value 'n.a.' (if field1 is NULL) or 'foo' (if field1 is set to string "foo"). Without the alias structure (i.e. "as field1"), mileage varies considerably on the name of the array key. /jm

« previous php.notes (#52003) next »