简体   繁体   English

mysql_num_rows为准备好的语句? PHP的MySQL的?

[英]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! 我知道这段代码行不通,我已经在mysql_num_rows中搜索了准备好的语句的答案,并且知道在哪里可以找到答案!

Thanks. 谢谢。

num_rows is a member of the prepared statement class. num_rowsnum_rows准备语句类的成员。 It's set after calling execute . 在调用execute之后设置。

$q->num_rows;

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM