Jump to content

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


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.