I'm working on creating a database application with a username/password login function. About a year ago I created a process form to check the username/password submitted through an HTML form against the corresponding info already existing in the MySQL database. The application seemed to work when I created it a year ago, but I've recently migrated the original code and database to a new development server and the process form doesn't seem to be matching the username/password entered from HTML with the username/password existing in the database, even though I know they are both correct. The connection to the database and the query seem to be working fine, but its the query results that seem to be the problem. Below is the code I'm using for the process form.
<?php
//connection to database "memberdirectory"
include ("dbconnect.inc");
$cxn= mysqli_connect($host, $user, $pass, $db);
if (!$cxn)
{
die('Unable to connect to database: ' . mysqli_error());
}
//password verification function
$userName=$POST['username'];
$userPass=$POST['password']; //password entered by user
$user_query="SELECT loginName FROM members WHERE loginName='$userName'";
$pass_query="SELECT password FROM members WHERE loginName='$userName'";
$user_result=mysqli_query($cxn,$user_query) or die ("Unable to execute query1" .mysqli_error());
$pass_result=mysqli_query($cxn,$pass_query) or die ("Unable to execute query2" .mysqli_error());
$user_row=mysqli_fetch_assoc($user_result);
$pass_row=mysqli_fetch_assoc($pass_result);
if (empty($userName)) {
echo "Invalid Username or Password1"; exit;}
if ($userPass == $pass_row['password'] && $userName == $user_row['username']) {header("Location: mainapp.php"); exit;}
else {
echo "'$pass_row', '$user_row'"; }
?>
The last echo function was a generic error, but I change it so I could see specifically what results the from was pulling from the database, but the only result I get is:
'Array', 'Array'
What I'm not sure about is if this result is what the form is actually pulling from the db or am I missunderstanding what results the function is actually supposed to display. Any help would be appreciated.