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]
|