我还是 PHP 和 mySql 的新手,然后我通过键入所有这些来学习,但结果是:警告:mysql_num_rows() 期望参数 1 是资源,布尔值在第 15 行的 /home/k1424852/public_html/welcome.php 中给出,然后我四处寻找,但没有任何解决方案:(,我压力很大:(,请帮助...
<?php session_start();
include('config.php');?>
<html>
<head>
<title> My Data </title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<?php include("header.php"); ?>
<p class="welcome" id="greeting">
<?php
$usercheck=$_POST["username"];
$passcheck=$_POST["password"];
$db_query= mysql_query("SELECT * FROM users WHERE username = '".$usercheck."'");
if (mysql_num_rows($db_query) == 1){ *//<----- line 15*
$record = mysql_fetch_array($db_query);
if (md5($passcheck) == $record['password']){
echo "Welcome, ". $usercheck ."! You are now logged in.<br/>";
$_SESSION['user']= $usercheck;
$_SESSION['pass']= $passcheck;
}
else
echo "Sorry, wrong password. <br/>";
}
else
echo "Sorry, wrong username.<br/>";
?>
<a href="index.php">Click here </a>to return to the main page.
<?php include("footer.php"); ?>
</body>
</html>
非常感谢您的帮助,我真的很想学习,但是如果我弄错了,就没有导师了。:(谢谢。