Re: The return of mysql_fetch_assoc()

From: Date: Wed, 30 Jul 2003 08:07:42 +0000
Subject: Re: The return of mysql_fetch_assoc()
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-157501@lists.php.net to get a copy of this message
""Ney andré de mello zunino"" <zunino@unu.edu> wrote in message news:20030730055110.84452.qmail@pb1.pair.com... > Thanks for the quick response, but I am not sure I understand your > argument. Yes, I am aware that the function returns an array > corresponding to a single row/record; what I don't understand is why I > am not able to apply a key directly to that "temporary" return value. In > other words, it is necessary to "copy" the resulting row into a new > variable so that it is then possible to use the column name (key) to > retrieve the desired value. Why don't you use : <?php list ($fooVar) = mysql_fetch_row(mysql_query("SELECT barColumn FROM table_name WHERE id = 1")); ?> This will do exactly what you need, if I understand you correctly. HTH, -- Ivo Fokkema PHP & MySQL programmer Leiden University Medical Centre Netherlands

« previous php.general (#157501) next »