Welcome Guest, Not a member yet? Register   Sign In
mysqli num rows blows up the script
#1

What is wrong with the below code. It fails on the num_rows, but gives no error message.. it just doesn't go beyond that point. This isn't actually codeignitor code, it's just straight PHP.
Code:
if($q = $mysqli->query($sql)) {
      //if($q->num_rows == 0)
       // echo "no rows!";
       fputs($file,"query has completed!".PHP_EOL);
       fflush($file);
       /* fetch associative array */
       $countRows = $q->num_rows(); // <== won't go past this
       fputs($file,"rows returned: ".$countRows.PHP_EOL);
Reply
#2

mysqli_result::$num_rows is a property, not a method.

You've used it correctly on the second line (but commented it out).
Reply




Theme © iAndrew 2016 - Forum software by © MyBB