php如何把数据集指针移动到第一条记录? 使用mysql_data_seek
[ 2012-03-09 10:59:27 | 作者: admin ]
<?
// Start snipit 1
$sql = "SELECT * from <table>";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
// do stuff with $row
}
mysql_data_seek($result, 0); //关键是这儿
while ($row = mysql_fetch_assoc($result)) {
// do other stuff with $row
}
?>
// Start snipit 1
$sql = "SELECT * from <table>";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
// do stuff with $row
}
mysql_data_seek($result, 0); //关键是这儿
while ($row = mysql_fetch_assoc($result)) {
// do other stuff with $row
}
?>
http://cn.php.net/manual/zh/function.mysql-data-seek.php#66814
[最后修改由 admin, 于 2012-03-09 11:00:23]
评论Feed: http://blog.xg98.com/feed.asp?q=comment&id=1801
这篇日志没有评论。
此日志不可发表评论。