Basic
Basic

Reputation: 1866

mysql_num_rows for prepared statements? php mysql?

if ($_SERVER['QUERY_STRING']) {
$q = $dbc -> prepare ("SELECT * FROM accounts WHERE email = ? && logcount = ''");
$q -> bind_param('s', ($_SERVER['QUERY_STRING']));
$r = $q -> execute();
    if ($r) {
        if (mysqli_num_rows($r) == 1) {
            echo 'Account Active';
        }
        else {
            header('location: create');
        }
    }}

I know this code doesn't work, I have searched for an answer to mysql_num_rows for prepared statements and know where has an answer that I can find!

Thanks.

Upvotes: 2

Views: 1937

Answers (1)

gen_Eric
gen_Eric

Reputation: 227310

num_rows is a member of the prepared statement class. It's set after calling execute.

$q->num_rows;

http://www.php.net/manual/en/mysqli-stmt.num-rows.php

Upvotes: 5

Related Questions