Jump to content


Photo

Login problems accessing mysql database


  • Please log in to reply
2 replies to this topic

#1 powerbasket

powerbasket
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 21 October 2006 - 06:24 PM

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

$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";


#2 JasonLewis

JasonLewis
  • Members
  • PipPipPip
  • Advanced Member
  • 3,351 posts
  • LocationVictoria, Australia

Posted 22 October 2006 - 11:58 AM

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."'");
then check if the user exists then check the password etc...
Good luck with your coding.
Jason / ProjectFear / Jaysonic

#3 powerbasket

powerbasket
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 22 October 2006 - 04:58 PM

Much simplier way to do it! :P




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users