检查数据库中现有条目的SQL查询无效

时间:2015-08-23 22:03:49

标签: php mysql sql

<?php
          error_reporting(0);
          $link = mysqli_connect("localhost", "root", "", "checksql"); 

          if($link === false){
            die("ERROR: Could not connect. " . mysqli_connect_error());
          }

          $myemailaddress=$_POST['useremail']; 
          $mypassword=$_POST['userpassword'];

          $sql = mysqli_query("SELECT * FROM register WHERE Email = '$myemailaddress' ");
          $count = mysqli_num_rows($sql);
          echo $count;

          if($count > 0){
            echo "success";
          } else{
            echo "failed";
          }
       ?>

我正在尝试检查数据库中是否存在电子邮件。我在stackoverflow上搜索了不同的线程并试图纠正它但失败了。即使是$ count的回声也没有表现出它的价值。有没有其他方法可以检查它?

0 个答案:

没有答案