views:

46

answers:

3

Hi,

In using PHP Prepared Statement, what is the syntax for counting number of rows?


$stmt = $conn->stmt_init(); $query = "SELECT * FROM TableName";

if($stmt->prepare($query)){
$stmt->num_row(); //SOMETHING SIMILAR TO THIS.... }

A: 
$stmt->num_rows
Trevor
A: 

For mysqli its num_rows. Make sure you call store_result beforehand.

Galen
A: 

Hi, I am assuming your are using mysqli. If so, then affected_rows() should give you the number of rows will give you the number of rows returned by a SELECT operataion.

jkndrkn