0

我发现他们两个都在做同样的工作。有没有区别。我想,我错过了一些东西。

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)
?>
4

1 回答 1

1
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

实际上,您的问题的答案与您复制此问题的页面相同

于 2013-04-26T17:48:57.903 回答