mysql_unbuffered_query与mysql_query的区别
Jun 07, 2016 pm 04:23 PMPHP mysql_data_seek() 函数 定义和用法 mysql_data_seek() 函数移动内部结果的指针。 语法 mysql_data_seek(data,row) 参数 描述 data 必需。返回类型为 resource 的结果集。该结果集从 mysql_query() 的调用中得到。 row 必需。想要设定的新的结果集指针的
PHP mysql_data_seek() 函数
定义和用法
mysql_data_seek() 函数移动内部结果的指针。
语法
mysql_data_seek(data,row)
参数
描述
data
必需。返回类型为 resource 的结果集。该结果集从 mysql_query() 的调用中得到。
row
必需。想要设定的新的结果集指针的行数。0 指示第一个记录。
说明
mysql_data_seek() 将 data 参数指定的 MySQL 结果内部的行指针移动到指定的行号。
接着调用 mysql_fetch_row() 将返回那一行。
row 从 0 开始。row 的取值范围应该从 0 到 mysql_num_rows – 1。
但是如果结果集为空(mysql_num_rows() == 0),要将指针移动到 0 会失败并发出 E_WARNING 级的错误,mysql_data_seek() 将返回 false。
返回值
如果成功则返回 true,失败则返回 false。
提示和注释
注释:mysql_data_seek() 只能和 mysql_query()一起使用,,而不能用于 mysql_unbuffered_query()。
例子
$conn = mysql_connect(‘localhost’,'root’,'root’);
mysql_query(‘set names gbk’);
mysql_select_db(‘pw8′,$conn);
$sql = "SELECT * FROM shop_district";
//$result = mysql_unbuffered_query($sql,$conn);
$result = mysql_query($sql,$conn);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf ("ID: %s FID: %s Name: %s
", $row[0], $row[1], $row[2]);
}
mysql_data_seek($result,0);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf ("ID: %s FID: %s Name: %s
", $row[0], $row[1], $row[2]);
}
mysql_free_result($result);

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to fix mysql_native_password not loaded errors on MySQL 8.4

Does Bitcoin have stocks? Does Bitcoin have equity?

deepseek What is the difference between r1 and v3 version

What is the difference between pre-market and after-market trading? Detailed explanation of the differences between pre-market and after-market trading

Why is Bittensor said to be the 'bitcoin' in the AI track?

Is there any difference between South Korean Bitcoin and domestic Bitcoin?

Pepe bought and sold out in a big way, is MUTM a smarter investment in 2025?
