mysql - PHP - mysqli_query count always returns 1 -


i kind of beginner in ...

for reason mysqli_query count returns 1

$class_number = $_post['class'];  $check_class_number = mysqli_query($con, " select * `academy` classnumber = '".$class_number."' ");  echo count($check_class_number); 

the current situation in mysql table:

1- have 2 rows

2- under column classnumber have same value 150701-100

i need count number of classnumber 150701-100, suppose in case returns 2. mentions returns 1, if added more rows.

my final intention add logical if code

 if(count($check_class_number)>0){                   echo "exists.";                    }else{                   echo "it not exist.";                    } 

your appreciated.

use mysqli_num_rows count number of rows returned query. count() work on array.

 if(mysqli_num_rows($check_class_number)>0) {       echo "exists.";  } else {       echo "it not exist.";  } 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -