gpt4 book ai didi

php - PDO 相当于 pg-result-seek

转载 作者:行者123 更新时间:2023-11-29 12:05:41 25 4
gpt4 key购买 nike

任何人都知道 pg-result-seek 的 PDO 等价物?我想使用 Postgre 倒带数据集。

最佳答案

PDO 的 query()方法将返回 PDOStatement Object .没有像您所要求的那样寻找特定记录的等价物。一种替代方法可能是使用 fetchAll()方法,然后获取您要查找的第 N 条记录。

<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();

/* Fetch all of the remaining rows in the result set */
print("Fetch all of the remaining rows in the result set:\n");
$result = $sth->fetchAll();
print_r($result);

$result[N] 将包含您要查找的行。

关于php - PDO 相当于 pg-result-seek,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19458208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com