note 43570 added to function.mysql-data-seek

From: Date: Fri, 25 Jun 2004 23:00:24 +0000
Subject: note 43570 added to function.mysql-data-seek
Groups: php.notes 
Request: Send a blank email to php-notes+get-71702@lists.php.net to get a copy of this message
An example how to display a random record from the result set using mysql_data_seek: <?php mysql_select_db($database, etc); $query_query = "SELECT * FROM table"; $result = mysql_query($query_query, $database) or die(mysql_error()); $totalRows_result = mysql_num_rows($result); mysql_data_seek($result , rand(0,$totalRows_result)); $row_result = mysql_fetch_assoc($result); ?> ---- Manual Page -- http://www.php.net/manual/en/function.mysql-data-seek.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43570 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43570&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43570&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71702) next »