Home Database Mysql Tutorial mysql_unbuffered_query与mysql_query的区别

mysql_unbuffered_query与mysql_query的区别

Jun 07, 2016 pm 04:23 PM
mysql query the difference

PHP 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);

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

How to fix mysql_native_password not loaded errors on MySQL 8.4

Does Bitcoin have stocks? Does Bitcoin have equity? Does Bitcoin have stocks? Does Bitcoin have equity? Mar 03, 2025 pm 06:42 PM

Does Bitcoin have stocks? Does Bitcoin have equity?

deepseek What is the difference between r1 and v3 version deepseek What is the difference between r1 and v3 version Feb 19, 2025 pm 03:24 PM

deepseek What is the difference between r1 and v3 version

Summary of FAQs for DeepSeek usage Summary of FAQs for DeepSeek usage Feb 19, 2025 pm 03:45 PM

Summary of FAQs for DeepSeek usage

What is the difference between pre-market and after-market trading? Detailed explanation of the differences between pre-market and after-market trading What is the difference between pre-market and after-market trading? Detailed explanation of the differences between pre-market and after-market trading Mar 03, 2025 pm 11:54 PM

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? Why is Bittensor said to be the 'bitcoin' in the AI ​​track? Mar 04, 2025 pm 04:06 PM

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

Is there any difference between South Korean Bitcoin and domestic Bitcoin? Is there any difference between South Korean Bitcoin and domestic Bitcoin? Mar 05, 2025 pm 06:51 PM

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? Pepe bought and sold out in a big way, is MUTM a smarter investment in 2025? Mar 03, 2025 pm 07:09 PM

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

See all articles