致命错误:未捕获错误:调用未定义函数mysql_query() 在C:\ xampp \ htdocs \ Daowat \ index.php:20堆栈跟踪中:#0 {main}抛出 在第20行的C:\ xampp \ htdocs \ Daowat \ index.php中
** 致命错误:未捕获错误:调用C:\ xampp \ htdocs \ Daowat \ index.php:20中未定义的函数mysql_query():堆栈跟踪:#0 {main}在第20行的C:\ xampp \ htdocs \ Daowat \ index.php中引发 **
$con = mysqli_connect("localhost","root","","daowat_db") or die("Couldn't connet to SQL server");
<?php include ( "./inc/connect.inc.php" ); ?>
<?php
session_start();
if (isset($_COOKIE['user_login'])) {
$_SESSION['user_login'] = $_COOKIE['user_login'];
header("location: index.php");
exit();
}
if (isset($_POST['login'])) {
if (isset($_POST['user_login']) && isset($_POST['password_login'])) {
$user_login = mysqli_real_escape_string($con,$_POST['user_login']);
$user_login = mb_convert_case($user_login, MB_CASE_LOWER, "UTF-8");
$password_login = mysqli_real_escape_string($con,$_POST['password_login']);
$rememberme = $_POST['rememberme'];
$num = 0;
$password_login_md5 = md5($password_login);
$resulta = ("SELECT * FROM users WHERE (username='$user_login' || email='$user_login') AND password='$password_login_md5' AND activated='1' AND blocked_user='0'");
$result=mysqli_query($con,$resulta);
$num = mysqli_num_rows($result); //******** Line 20
$get_user_email = mysqli_fetch_assoc($result);
$get_user_uname_db = $get_user_email['username'];
if ($num>0) {
$_SESSION['user_login'] = $get_user_uname_db;
if ($rememberme != NULL) {
setcookie('user_login', $user_login, time() + (365 * 24 * 60 * 60), "/");
}
header('location: index.php');
exit();
}
else {
答案 0 :(得分:0)
在PHP配置中未启用Mysql扩展时,导致此错误。
在php.ini配置文件中
;extension=mysqli.so
应该是
extension=mysqli.so