从我的数据库中选择数据后,我继续在mysql_query
上收到SQL错误“没有这样的目录或文件”。
<?php
require_once ('config.php');
session_start();
$select_db = mysql_select_db(DB_NAME);
if ($select_db) {
die("no db" . mysql_error());
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = mysql_real_escape_string($config, $_POST['username']);
$password = mysql_real_escape_string($config, $_POST['password']);
$query = "SELECT id FROM members WHERE username='$username' and password='$password'";
$result = mysql_query($config, $query)or die("unable to find data " . mysql_error());
$row = mysql_fetch_array($result, MYSQLI_ASSOC);
$count = mysql_num_rows($result);
if ($count == 1) {
$_SESSION['login_user'] = $username;
header('location: home.html');
} else {
echo "invalid credentials";
}
}
?>
错误发生在以下行(也如上所示):
$result=mysql_query($config, $query) or die("unable to find data ".mysql_error());
有谁知道为什么我得到“没有这样的目录或文件”SQL错误?
答案 0 :(得分:0)