hello everyone! I have a problem with my login code… I have here a code that deals with an empty result set in mysql… I have already dealt with that problem. However, I got into another problem which is the retrieval of a record if the result set is not empty… I am hoping for your reply… thanks!
if($row=mysql_num_rows($result)==0){
echo "EMPTY";
}
else{
while($row=mysql_fetch_assoc($result)){
$userID=$row['id_num'];
$userName=$row['name'];
$userPass=$row['password'];
echo "<form action='index.php' method='POST'>";
echo "<input type='hidden' name='userID' value='$userID'>";
echo "<input type='hidden' name='userName' value='$userName'>";
echo "<input type='hidden' name='userPass' value='$userPass'>";
echo "</form>";
}
$userID=isset($_POST[‘userID’]) ? $_POST[‘userID’] :"";
$userPass=isset($_POST[‘userPass’]) ? $_POST[‘userPass’] :"";
$userName=isset($_POST[‘userName’]) ? $_POST[‘userName’] :"";
echo “JUST CHECKING—<br>input: $id<br>$pass2<br>Table:$userID<br>$userPass<br>—<br>”;
if($userID==""&&$userPass){
echo "<br>No Entry";
}
if($pass2!=$userPass){//password field is empty or mismatch
echo "Passwords do not match";
}
if($id!=$userID){
echo "<br>ID numbers do not match";
}
else{
echo "Welcome $userName";
}
}