You are here: Re: retrieve individual rows from mysql_fetch_array not using while loop « PHP Programming Language « IT news, forums, messages
Re: retrieve individual rows from mysql_fetch_array not using while loop

Posted by Petr Vileta on 08/15/06 12:53

"monomaniac21" <mcyi2mr3@googlemail.com> píse v diskusním príspevku
news:1155631883.433492.177770@i3g2000cwc.googlegroups.com...
> 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
>
>
> but this doesnt seem to be working?
>
You can to modify sql query for returning one row only (eg. using HAVING
....) or you can use
mysql_data_seek() before mysql_fetch_array().

Tip for you:
mysql_fetch_assoc() is more friendly then mysql_fetch_array().
--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)

 

Navigation:

[Reply to this 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

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