betulas Posted November 18, 2009 Share Posted November 18, 2009 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. Link to comment https://forums.phpfreaks.com/topic/181950-warning-mysql_query-supplied-argument-is-not-a-valid-mysql-link-resource-in/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 18, 2009 Share Posted November 18, 2009 Your code in connection.php is either failing to make a connection or it is not setting $con to the link resource returned by the mysql_connect() function call. Link to comment https://forums.phpfreaks.com/topic/181950-warning-mysql_query-supplied-argument-is-not-a-valid-mysql-link-resource-in/#findComment-959724 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.