Reply to Re: retrieve individual rows from mysql_fetch_array not using while loop

Your name:

Reply:


Posted by Rik on 08/15/06 10:34

monomaniac21 wrote:
> hi all
>
> im querying a db for two rows which are always returned. how can i
> reference each row and output its contents without using a while loop.
> ive tried:
>
> $row = mysql_fetch_array($result);
> extract $row;
> echo $var1[0]; //var 1 of row 0
> echo $var1[1]; //var 1 of row 1

Nope, it won't.
You only retrieve 1 row, you call mysql_fetch_array just once.
Furthermore, extract will create vartiables named after you fieldnames or
aliasses deriving from the query.

I think you're looking for this:
$row0var1 = mysql_result($result,0,0); (or: mysql_result($result,0); for the
first value)
$row1var1 = mysql_result($result,1,0);

Grtz,
--
Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация