Jump to content

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in


betulas

Recommended Posts

So, I keep getting this error messgae regarding my log in, the databse (my query broswer) is all connected and is receving the relevant user names and passes. here is the code:

<?

session_start(); // begin a session because we will be working wit $_SESSION variables

require("connection.php"); // DB connection info

$u = $_POST['username'];

$pw = $_POST['password']; // get the login info from the previous form

 

// try to find a row in the users table that matches the exact username and password combination

$check = "SELECT username, password FROM users WHERE username='$u' AND password='$pw'";

 

$login = mysql_query($check, $con) or die(mysql_error()); // run the query or DIE

if (mysql_num_rows($login) == 1) { // if there is exactly 1 result, we can assume that the login information was correct

$_SESSION['username'] = $u; // create a SESSION variable of username with a value of the username they logged in with

header("Location:userlist.php"); // redirect them to a different page

} else {

header("Location:login.php"); // if login failed, send them back to the login page

}

mysql_close($connect);

?>

 

And this is the error;

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/abarefoot/public_html/login-do.php on line 10

 

any help would be great, thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.