【问题标题】:Mysql_query Call to Undefined Function mysql_query() [duplicate]Mysql_query 调用未定义函数 mysql_query() [重复]
【发布时间】:2021-09-26 18:15:44
【问题描述】:

以下是代码, 我不断收到未定义的功能。 我也想知道使用 mysql 和 mysqli 的区别 未捕获的错误:调用未定义的函数 mysql_query()

```<?php

//Check if the user has filled in the details.// 

if( !Isset($_POST['username'],$_POST['password']))
{
die ("<script>alert('Please Fill Both Username and Password')
</script>");
    } 
else
{
session_start();

//check on the posted values 

$username= $_POST[('username')];
echo $username;
include('conn.php');

$password=$_POST[('password')];
echo $password;

}
//Verify Password
$result=mysql_query("Select * From user_`enter code here`info
where username='$username' AND passsword='$password'");
//Count the number if it exists
$total=mysql_num_rows($result);
//check if the credentials exists

If($total==1){
echo"Validated";
}
else{
echo"dead";
}


?>```

【问题讨论】:

标签: php mysql function


【解决方案1】:

mysql_query() 在 PHP 以前的版本中已被贬低。现在您必须改用 mysqli_query() 。 用你的代码替换这部分代码

 //Verify Password
$result=mysqli_query("Select * From user_`enter code here`info
where username='$username' AND passsword='$password'");
//Count the number if it exists
$total=mysqli_num_rows($result);
//check if the credentials exists

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-22
    • 2012-10-23
    • 2016-05-03
    • 1970-01-01
    • 2014-10-27
    • 2016-08-13
    • 2016-11-22
    • 1970-01-01
    相关资源
    最近更新 更多