Jump to content


This topic is now archived and is closed to further replies.


Login problems accessing mysql database

Recommended Posts

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");
$sr1 = $dbusername;
$sr2 = $dbname;
$sr3 = $dbpassword;
} else {
echo "Your username & password was not found, please click below and try again";[/code]

Share this post

Link to post
Share on other sites
[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...

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.