After I perform a database query, and some rows are echoed, it seems that I can’t get the number of rows which are shown, after the query. Tried to use mysql_num_rows() but my $result is like this:
$result = $conn->query($sql) or die();
so I think that the problem is that I’ve used the built-in MySQLi() class, and for some reason
mysql_num_rows() is not working in accordance with this $result. How can I get it to work with the current $result I’m using, or is there any other way to return the number of rows using the MySQLi() class to create the $result??
mysql and mysqli are NOT interchangeable. They’re two completely different modules, maintain their own separate connections, and are results/handles from one are NOT useable in the other. They may both use the same underlying mysql libraries and talk to the same database, but they’re utterly independent of each other.
If you’re using MySQLi, then stick with MySQLi functions, which for your problem would be to use http://php.net/manual/en/mysqli-stmt.num-rows.php