note 35763 added to function.mysql-result

From: Date: Sat, 13 Sep 2003 17:54:25 +0000
Subject: note 35763 added to function.mysql-result
Groups: php.notes 
Request: Send a blank email to php-notes+get-56453@lists.php.net to get a copy of this message
I frequently use mysql_result() together with mysql_fetch_array(), kinda like that... :-) <? $query="SELECT id, name, something_else FROM table"; $rawdb=mysql_query($query); ?> <table> <tr><td><?=mysql_result($rawdb, 0, "name")?></td></tr> <? mysql_data_seek($rawdb, 0); while($array=mysql_fetch_array($rawdb, MYSQL_ASSOC)){ extract($array); ?> <tr><td><?=$id?></td><td><?=$something_else?></td></tr> <? } mysql_free_result($rawdb); ?> </table> Took me a while to figure out what to do with mysql_data_seek when you are using mysql_result and mysql_fetch_array on the same query. Hope it helps someone else. :-) ---- Manual Page -- http://www.php.net/manual/en/function.mysql-result.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35763 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35763&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35763&report=yes

« previous php.notes (#56453) next »