powerbasket Posted October 21, 2006 Share Posted October 21, 2006 Hi there,Im working on a relatively simple script but I am stuck with a login section.It seems to only accept one of the entires in the database but I need multiple login details. Heres the code, if someone can tell me why this isn't working it would be a great help[code]$result = mysql_query("SELECT * FROM advisors")or die(mysql_error()); $row = mysql_fetch_array( $result );$dbname = $row['name'];$dbpassword = $row['password'];$dbusername = $row['username'];if ($username==$dbusername && $password==$dbpassword){ include("welcome.php");session_register("sr1");session_register("sr2");session_register("sr3");$sr1 = $dbusername;$sr2 = $dbname;$sr3 = $dbpassword;} else { echo "Your username & password was not found, please click below and try again";[/code] Link to comment https://forums.phpfreaks.com/topic/24676-login-problems-accessing-mysql-database/ Share on other sites More sharing options...
JasonLewis Posted October 22, 2006 Share Posted October 22, 2006 [code]so... its not checking both username and password, and that is a weird way to check the login. should it be something like [code=php:0]$result = mysql_query("SELECT * FROM advisors WHERE username='".$username."'");[/code] then check if the user exists then check the password etc... Link to comment https://forums.phpfreaks.com/topic/24676-login-problems-accessing-mysql-database/#findComment-112638 Share on other sites More sharing options...
powerbasket Posted October 22, 2006 Author Share Posted October 22, 2006 Much simplier way to do it! :P Link to comment https://forums.phpfreaks.com/topic/24676-login-problems-accessing-mysql-database/#findComment-112701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.