num_rows method not bringing back number of selected rows

BRarononfab

New Member
This is the code:\[code\]$q = $this->db->prepare("SELECT id FROM `users` WHERE username=? AND password=? LIMIT 1");$q->bind_param('ss', $username, $password);$q->execute();printf('Rows returned: %i', $q->num_rows); \[/code\]I am using MySQLi to try and check a users login credentials. Everything works and the query gets executed and data is returned (I have checked this seperately) but I only get this output: \[code\]Rows returned:\[/code\]Is there anything wrong here? I'm new to using MySQLi but going by the PHP.net examples there's nothing wrong with this code. Cheers.
 
Back
Top