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'];