php check if db query was successful code example
Example: php check if query succeeded
<?php
// peform a query
$query = "SELECT `*` FROM user";
$results = mysqli_query($databaseConnection, $query);
if (mysqli_num_rows($results) == 0) {
// The query returned 0 rows!
} else {
// the query returned ATLEAST one row
}
if (mysqli_num_rows($results) >= 5) {
// the query returned more than 5 rows
}
?>