Re: Strange anomolie with each() and mysql_fetch_array()

From: Date: Fri, 24 Jan 2003 05:46:57 +0000
Subject: Re: Strange anomolie with each() and mysql_fetch_array()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-132948@lists.php.net to get a copy of this message
First, if you expect only a single row returned, why are you using a while(){} construct? Second, mysql_fetch_array() does not like to operate within another function call. I've tried it on multiple occasions; failed. Third, each() operates on succeeding elements of an array; there are only two elements aparrently, so what are you expecting eac() to do? ----- Original Message ----- From: "Daevid Vincent" <daevid@daevid.com> To: <php-general@lists.php.net> Sent: Thursday, January 23, 2003 11:38 PM Subject: [PHP] Strange anomolie with each() and mysql_fetch_array() How come I *can* do these commands: $row = mysql_fetch_array($result,MYSQL_ASSOC); while(list($myVariableName,$sqlFieldName)=each($row)) { $$myVariableName = $sqlFieldName; } But I can't do this command? while(list($myVariableName,$sqlFieldName)=each(mysql_fetch_array($result ,MYSQL_ASSOC))) { $$myVariableName = $sqlFieldName; } Notice the only differenceis that the first one assigns the array to $row FIRST, whereas the second tries to avoid that extra call, especially since I know I'm only getting one row back. Hmmm? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#132948) next »