php check if query succeeded

Solutions on MaxInterview for php check if query succeeded by the best coders in the world

showing results for - "php check if query succeeded"
Noam
14 Jan 2019
1<?php
2	// peform a query 
3      $query = "SELECT `*` FROM user";
4      $results = mysqli_query($databaseConnection, $query);
5
6      if (mysqli_num_rows($results) == 0) {
7        // The query returned 0 rows!
8      } else {
9        // the query returned ATLEAST one row
10      }
11
12      if (mysqli_num_rows($results) >= 5) {
13        // the query returned more than 5 rows
14        }
15?>