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.
如果我有一个我知道只会返回一个结果的语句:
$emp_query = "SELECT * FROM table WHERE id = 'employee_id' LIMIT 1"
$emp_query = "SELECT * FROM table WHERE id = 'employee_id' LIMIT 1
有什么方法可以在不使用和 while 循环的情况下访问pg_query($con, $csr_query);关联数组的结果?pg_fetch_assoc当我知道我只检索一条记录时,while 循环似乎是不必要的。也许 PDO 中也有一些方法,我只是先这样设置它,因为我更喜欢简单的方法。谢谢。
pg_query($con, $csr_query);
pg_fetch_assoc
类似 pg_fetch_result 的东西:
http://www.php.net/manual/en/function.pg-fetch-result.php