mysqli_num_rows fails with prepared statement , procedural style
问题 I am learning Mysqli ( come from Mysql ). I as far as I understood, the advantage of using prepared statements is to prevent SQL injections. I managed to build queries with prepared statments using SELECT and INSERT. But to achieve the equivalent of select count() , and I'm banging my head against the wall. The PHP manual gives: if ($result = mysqli_query($link, "SELECT Code, Name FROM Country ORDER BY Name")) { /* determine number of rows result set */ $row_cnt = mysqli_num_rows($result);