Instead of doing:
$cars = $mysqli->query("SELECT * FROM cars");
$count = $cars->num_rows();
if ($count) {
// is rows
}
I want to not have to select all rows or a single column, I simply want the count.
In my head:
$cars = $mysqli->query("SELECT COUNT(*) as count FROM cars");
But then how do I use that count value? I need to run an if statement on it.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…