Jump to content

Does this code mean what i think it does?


PHPFAN10

Recommended Posts

Hello :)

 

Newbie to the forum here and found you via Google, looks like a great site and forum hence why i registered and to get help when needed.

 

Can someone please tell me if the following code means if the query fails in anyway like when updating DB or any other failure it will display the error message else if query updated successfully it will go to else and continue as normal?

 

Reason i ask as not sure if it means if update query fails display error else query ok so continue or it will fail if it cannot connect to db or typo in query itself?

 

I think it would fail if any mysql error happens on query but not sure if it means would go to error if failed on anything or just certain things.

 

Thanks for any help. I know it's not the full code but it's this part i want to understand.

 

 
# Databse query
$query = mysql_query("SELECT id, admin, username, first_name, last_name, email
               FROM `users` WHERE username = '$username' AND
               password = '$password' LIMIT 1");

# Check login query
if(!$query){
        echo 'Oops';
} else {
        echo 'Done!';       
}   

Archived

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

×
×
  • 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.