Howdy y'all. I figure we have computer savvy people here who might know the issue.
I'm trying to do a simple login that checks a database. I've checked my variables 100 times so I know thats not the issue. Every time I run mysql-count-rows I just keep getting 0. If someone here knew what the issue was I'd appreciate it a ton.
I'm trying to do a simple login that checks a database. I've checked my variables 100 times so I know thats not the issue. Every time I run mysql-count-rows I just keep getting 0. If someone here knew what the issue was I'd appreciate it a ton.
PHP:
<?php
$username = empty($_POST['username']) ? '' : $_POST['username'];
$password = empty($_POST['password']) ? '' : $_POST['password'];
$myhost = "my database host";
$myuser = "my username";
$mypsw = "my password";
$mydb = "my database name";
$dblink = mysql_connect($myhost, $myuser, $mypsw) or die("Error: cannot connect");
$db_selected = mysql_select_db($mydb, $dblink) or die("Error: cannot select db");
$query1 = "select S.sid from Sailors S where S.username = '".$username."' and S.password = '".$password."';";
if (mysql_num_rows($query1, $dblink) != 0)
{
setcookie('username', $username);
header("Location: main.php");
}
?>