[英]Difference between mysql_data_seek and mysql_field_seek?
我發現他們兩個都在做同樣的工作。 有沒有區別。 我想,我錯過了一些東西。
mysql_data_seek
<?php
$sql="SELECT * from testing";
$result=mysql_query($sql);
$row = mysql_fetch_object($result);
echo $row->id . ' ' . $row->name; // Output is (1 Hassan)
mysql_data_seek($result,2);
$row = mysql_fetch_object($result);
echo $row->id . ' ' . $row->name; // Output is (3 Rose)
echo "<BR><BR>";
?>
mysql_field_seek
<?php
mysql_connect("sql.server.com", "username", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$sql="SELECT * from table1";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);
echo $row['ID'] . ' ' . $row['Name']; // Output is (1 Hassan)
mysql_field_seek($result,2);
echo $row['ID'] . ' ' . $row['Name']; // Output is (3 Rose)
?>
mysql_data_seek - moves to a specific row of the dataset
mysql_field_seek - moves to a specific column of current row of the dataset
實際上,您問題的答案與您復制該問題的頁面相同
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.