Little PHP MySql help.
#7

Why you make double query? This should work->
PHP код:
 $q mysql_query("SELECT * FROM `users` WHERE username = '$username' AND password = '$password'") or die (mysql_error()); // mySQL query
    
$r mysql_num_rows($q); // Checks to see if anything is in the db.
        
if ($r == 1) { // There is something in the db. The username/password match up.
        
$_SESSION['logged'] = 1;
        
$row mysql_fetch_array($q)
        
$_SESSION['admin'] = $row['admin'];
    
header("Location: site.php"); // Goes to main page.
        
exit(); // Stops the rest of the script.
        
} else { // Invalid username/password.
header("Location: login.php"); // Goes back to login page.
    

Reply


Messages In This Thread
Little PHP MySql help. - by ricardo178 - 08.09.2012, 13:06
Re: Little PHP MySql help. - by Extremo - 08.09.2012, 13:14
Re : Re: Little PHP MySql help. - by ricardo178 - 08.09.2012, 13:17
Re: Little PHP MySql help. - by Extremo - 08.09.2012, 13:23
Re : Little PHP MySql help. - by ricardo178 - 08.09.2012, 13:31
Re: Little PHP MySql help. - by Extremo - 08.09.2012, 13:34
Re: Little PHP MySql help. - by BrandyPenguin - 08.09.2012, 13:40
Re: Little PHP MySql help. - by Extremo - 08.09.2012, 13:42

Forum Jump:


Users browsing this thread: 1 Guest(s)