cs.punk Posted April 8, 2009 Share Posted April 8, 2009 I saw some code with SELECT example, example2, example3 FROM bla bla bla... But I can't get this code to extract the 'rank' if (isset ($_POST['username']) && ($_POST['password']) ) {$con = mysqli_connect ("$dbhost","$dbuser","$dbpass","$dbname") or die ("Couldn't connect to server"); $username = mysqli_real_escape_string($con, strip_tags(trim($_POST['username']))); $username = strtolower($username); $password = mysqli_real_escape_string($con, strip_tags(trim($_POST['password']))); $password = md5($password); $query = "SELECT password,rank,id FROM users WHERE username= '$username' "; $result = mysqli_query($con,$query) or die ("Couldn’t execute query."); $row = mysqli_fetch_assoc($result); if ($password == $row['password']) {$_SESSION['user'] = "$username"; $_SESSION['rank'] = "$rank"; echo "Thank you {$_SESSION['user']} You have succsessfully logged in! $id {$_SESSION['rank']}"; } else {echo "The username and password does not match, please double check and try again."; } Quote Link to comment Share on other sites More sharing options...
trq Posted April 8, 2009 Share Posted April 8, 2009 Your going to need to be allot more descriptive than that I'm afraid. Quote Link to comment Share on other sites More sharing options...
trq Posted April 8, 2009 Share Posted April 8, 2009 This.... $_SESSION['rank'] = "$rank"; needs to be.... $_SESSION['rank'] = $row['rank']; Quote Link to comment Share on other sites More sharing options...
cs.punk Posted April 8, 2009 Author Share Posted April 8, 2009 Whoops.... Thanks allot dude! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.