我不断收到使用的错误消息mysql_num_rows(),您能帮我弄清楚我的代码出了什么问题吗?
这是我的代码:
<?php
//check if the user press submit
if (isset($_POST['submit'] )) {
$customer = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["username"]); // filter everything but numbers and letters
$password = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["password"]); // filter everything but numbers and letters
$sql = mysql_query("SELECT id FROM members WHERE username='$customer' AND password='$password' LIMIT 1"); // query the person
// ------- MAKE SURE PERSON EXISTS IN DATABASE ---------
$existCount = mysql_num_rows($sql); // count the row nums
if ($existCount == 1) { // evaluate the count
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
}
$_SESSION["id"] = $id;
$_SESSION["customer"] = $customer;
$_SESSION["password"] = $password;
header("location: index.php");
exit();
} else {
echo 'That information is incorrect, try again <a href="customer_login.php">Click Here</a>';
exit();
}
}
?>
我已经mysql_errno()按照您的建议尝试了..它回显1146
当我搜索该错误时说
1146: Table 'kossu.nonexistenttable' doesn't exist
但是我不知道这意味着什么...请帮助。
元芳怎么了
倚天杖