PHP mysql_data_seek() function tutorial
Definition and usage
The mysql_data_seek() function moves the internal row pointer.
The contiguous internal pointer is currently queued as returned by the mysql_query() function.
This function returns TRUE on success, or FALSE on failure.
Grammar
mysql_data_seek(data,row)
参数
data: 从mysql_query数据库查询
rows:查出多少行.
现在我们来看个mysql_data_seek的实例吧.
<?
<pre class="brush:php;toolbar:false">$sql = "SELECT * from Person"; $result = mysql_query($sql,$con); print_r(mysql_fetch_row($result));
mysql_data_seek($result,3); print_r(mysql_fetch_row($result));
?>
输出的结果.
<pre class="brush:php;toolbar:false">Array ( [0] => Refsnes [1] => Kai Jim [2] => Taugata )
Array ( [0] => Refsnes [1] => Ståle [2] => Sandnes )