此代码无法识别我数据库上的登录用户。我已经尝试了几件事,到目前为止都没有任何影响。有人可以指出错误吗
<?php
session_start();
include("dbconnect.php");
$numrows=0;
$sqlMember = mysql_real_escape_string($_POST["Membership_Number"]);
$sqlPassword = mysql_real_escape_string($_POST["Password"]);
$query="SELECT First_name, Last_name, Membership_Number FROM members WHERE Membership_Number='$member' AND Password='$password'";
$link = mysql_query($query);
if (!$link) {
die('login error');
}
$numrows=mysql_num_rows($link);
if ($numrows>0){ // authentication is successfull
while($row = mysql_fetch_array($query));
$_SESSION['user']['first_name']=$row['first_name'];
$_SESSION['user']['last_name']=$row['last_name'];
$_SESSION['user']['Membership_Number ']=$row['Membership_Number '];
echo $_SESSION['user']['fname'].' '.$_SESSION['user']['lname'];
header("location:members_area.php");
} else {
header("location:../invalid.php"); // authentication was unsuccessfull
}
?>
HTML
<form id="jjjj" action="Send_log_details.php" class="register" method="POST">
<ul>
<li>
Membership Number:<br>
<input type="text" id="Membership_Number" name="Membership_Number">
</li>
<li>
Password:<br>
<input type="password" id="Password" name="Password" value="Log in">
</li>
<li>
<input type="submit" name="register" value="Login" onclick="logMeIn()">
</li>
</ul>
</form>
谢谢你的帮助