Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个简单的查询
$qry = "select MAX(image_id) from tpf_images"; $res = $pdo->query($qry);
结果只是一个数字。用php回显该数字的最快,最简单的方法是什么?
谢谢
我认为 fetchColumn() 是您正在寻找的。它检索下一行第一列。由于您只有一行和一列,它将返回第一行和第一列的值。如果没有从数据库返回行,它将返回 FALSE。
echo $pdo->query($qry)->fetchColumn();