php 用户注册 num 行不起作用

标签 php mysql methods

我知道这个问题已经被问过很多次了。我是一个新手,我不知道为什么 mysqli_num_row 不起作用。即使我尝试了调用的过程方法和 OO 方法。计数仍然是 0。帮帮我,先谢谢了。如果有任何问题请原谅。

编辑: 我在发布这个问题时犯了一个错误,电子邮件未加密。所以我要删除电子邮件上的加密。但脚本仍然无法工作。

<html>
<body>
     <h1 user registration </h1>
    <form action="" method="POST">
            Email: <input name="ema" type="text" >  <br>
            Password: <input name="pwd" type="password" required> <br>
            <input value="submit" type="submit">
    </form> 
 <?php 
        require_once("connect.php"); 
        @$email = $_POST['ema'];    
        @$password = hash('sha512' , $_POST['pwd']);
        // SELECTING THE USER
            $sql = " SELECT * FROM `users` WHERE ema = '$email' and pwd = '$password' ";
            $result = mysqli_query($con, $sql);
            if ($result)
            {
                echo "code is working" ;
                $count = $result->num_rows;
                echo $count;
            }
    ?>
</body>
</html>    

最佳答案

您首先获取行

$row = $result->fetch_row();
$count = $row->num_rows;

关于php 用户注册 num 行不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38968195/

相关文章:

php - 如何让 mysql id 出现在链接上?

mysql - 每个 ID 限制为两个结果

mysql - 当操作影响集合时更新和删除一组行

objective-c - 类别中重写的方法是否始终优先于原始实现?

php - "Strict Standards: Only variables should be passed by reference"错误

php - 无法访问该文件。没有许可。虽然 [-rw-rw-rw]

php - Mysql 两个参数错误

java - while循环Int return方法内部完全死了

C++ 将方法指针作为模板参数传递

php - 不同ftp的子域之间的Ajax请求