连接工作时PHP抛出查询错误

时间:2018-05-20 09:15:37

标签: php web

我有几行PHPMysql无效。连接正在工作,但查询给我一些问题。

$con=mysqli_connect("localhost","$username","$password","$username");

if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$sql="SELECT * FROM `AUT` WHERE USERNAME='$user' AND PASSWORD='$pass'";
$result=mysqli_query($con, $sql);
$rowcount=mysqli_num_rows($result);  //line 21

if ($rowcount==1)
  {
    echo 'WELCOME';
    printf("Result set has %d rows.\n",$rowcount);
 }
ELSE
 {   
    echo'ERROR';
    printf("The Results is %d \n",$result);
}

我一直得到的结果是:

  

mysqli_num_rows()期望参数1为mysqli_result,boolean   在第21行的/storage/ssd3/588/2634588/public_html/login.php中给出

任何人都可以帮助我吗?

0 个答案:

没有答案