我一直在收到错误消息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();
}
}
?>
Run Code Online (Sandbox Code Playgroud)
我已经mysql_errno()按照你的建议尝试了......它回应了1146
当我搜索那个错误时,就说出来了
1146: Table 'kossu.nonexistenttable' doesn't exist
Run Code Online (Sandbox Code Playgroud)
但我不知道这意味着什么...请帮助.
| 归档时间: |
|
| 查看次数: |
57668 次 |
| 最近记录: |