login script *rips hair out*

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

just do

SELECT username FROM users WHERE username='$username' AND password = '$password'

with this you dont need to compare the password outside the query, less lines of code in other words.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

RoMeRz wrote:can i ask,

$db_password = $db_password['password'];

could someone explain this for me please. I just quite understand what the ['password'] bit at the end is for.

ta
$db_password contains and associative array of the results of the query.

so $db_password['password'] will contain whatever was in the password field of the MySQL Database.

Read [php_man]mysql_fetch_array[/php_man]

Mark
RoMeRz
Forum Newbie
Posts: 7
Joined: Mon Dec 01, 2003 3:19 pm
Location: Scotland

Post by RoMeRz »

ah right, cheers m8 :D
Post Reply