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.
如果您有类似的查询
SELECT max(customerID) FROM customers
有没有办法将它直接保存到变量而不是使用
$results = $dbLink->query("SELECT max(customerID) FROM customers"); while($row = $results->fetch_assoc()){ $maxID = $row['customerID']; }
后者只是 1 值的很多类型
这很容易 - 只是不要使用循环:
$results = $dbLink->query("SELECT max(customerID) FROM customers"); $row = $results->fetch_assoc(); $maxID = $row['customerID'];