so i'm having an issue with an "admin login" that i've been trying to make work. If you guys can check out my code to see what's going on, it would be very helpful. All of the names match what's in mysql. The error keeps coming up saying I don't have the correct username/password... but I do!
<?php
if (isset($_POST['login'])){
$con = mysql_connect("localhost", "dxhxxx", "tcqxxx");
if (!$con){
die("Cannot connect:" . mysql_error());
}
mysql_select_db("dxh6110",$con);
$userName = $_POST['username'];
$passWord = $_POST['password'];
$sql = "select * from Churchadmin where username='$userName' AND password='$passWord'";
mysql_query($sql,$con);
if(mysqli_num_rows($run)>0){
$_SESSION['username']=$userName;
$_SESSION['password']=$passWord;
//if all information is good you will go to the next page
echo "<script>window.open('view_prayers.php','_self')</script>";
}
//if password or username is wrong this will give them an alert
else{
echo "<script>alert('Admin details are incorrect!')</script>";
}
}
mysql_close($con);
?>