php - 如何从sql select查询结果中一次读取两条记录?

标签 php mysql

我想每次从 PHP 的 select 查询结果中读取两条记录?

最佳答案

像这样:

while($row1 = mysql_fetch_array($result))
{
  $row2 = mysql_fetch_array($result);
  // Do something
}

编辑:

那么就变成这样了

$row1 = mysql_fetch_array($result);
while($row2 = mysql_fetch_array($result))
{
  // Do something
  $row1 = $row2
}

关于php - 如何从sql select查询结果中一次读取两条记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5203438/

相关文章:

mysql - 使用VBA将数据插入MySQL数据库

php - Amazon S3 - 405 方法不允许使用 POST(尽管我允许在存储桶上使用 POST)

php - CodeIgniter num_rows 和affected_rows 上下文

php - 如何从数据库获取浮点解析值?

javascript - 如何在 Angular js中获取 Controller 的路由值

java - quartz 和 mysql 的自动模式创建失败并出现 MySQLSyntaxException

php - 使用数组更新数据库

php - 为什么 FILTER_VALIDATE_URL 不适用于波斯字符?

php - 下载时给图像加水印...可能吗?

php - 无法在 WordPress 环境中以编程方式创建用户