dr5648 2016-08-16 06:43
浏览 46

php用户注册num行无效

I know this question is already asked so many times. i am a newbie and i dont know why mysqli_num_row is not working.Even i tried procedural method of calling and OO method. still the count is 0. help me out, thanks in advance. excuses if any wrong in question.

EDITED: I made a mistake on posting this question , Email is not encrypted. so i am removing the encryption on email. but the script is still not working.

<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>    
  • 写回答

2条回答 默认 最新

  • duanfangfei5558 2016-08-16 06:48
    关注

    You first fetch rows

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

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂