Re: list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth) fails.

From: Date: Thu, 29 Jul 2004 16:22:18 +0000
Subject: Re: list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth) fails.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192203@lists.php.net to get a copy of this message
> Why does this fail when using an array element, but using a variable will > work? Why should PHP care what the variable is I'm trying to store into? > > list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth); Wouldn't it be easier to simply do: $result = mysql_fetch_row($sth); And then work with the $result array? If your DB indexes are listed as CompanyCode and CompanyDB, then use: $result = mysql_fetch_array($sth); Then you have your variable names like you want: $result['CompanyCode'] and $result['CompanyDB'] -- --Matthew Sims --<http://killermookie.org>

« previous php.general (#192203) next »