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."; } Link to comment https://forums.phpfreaks.com/topic/153124-solved-selecting-multiple-columns-from-a-table/ 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. Link to comment https://forums.phpfreaks.com/topic/153124-solved-selecting-multiple-columns-from-a-table/#findComment-804316 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']; Link to comment https://forums.phpfreaks.com/topic/153124-solved-selecting-multiple-columns-from-a-table/#findComment-804317 Share on other sites More sharing options...
cs.punk Posted April 8, 2009 Author Share Posted April 8, 2009 Whoops.... Thanks allot dude! Link to comment https://forums.phpfreaks.com/topic/153124-solved-selecting-multiple-columns-from-a-table/#findComment-804323 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.