php - MySQL results count -



php - MySQL results count -

i trying number of results mysql query using php, tried:

$query = mysqli_query($connection, "select email `appointments` email = '" . $email . "'"); $results = 0; while($row = mysqli_fetch_assoc($query)){ $results++; } homecoming $results;

the issue returns 9

i did print_r on $query , returned this:

mysqli_result object ( [current_field] => 0 [field_count] => 1 [lengths] => [num_rows] => 9 [type] => 0 )

my question is, how number of results of mysql query using php.

i suppose can utilize select count(*) unless, else has improve idea.

try this:

$query = mysqli_query($connection, "select email `appointments` email = '" . $email . "'"); $result = mysqli_fetch_array($query); homecoming mysqli_num_rows($result);

php mysql

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -