Jump to content

Login problems accessing mysql database


powerbasket

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");
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
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...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.