8 thoughts on “PHP MySQL Login Form

  1. Is there a reason to not select from DB where username AND password match (encrypting what’s entered for pass to compare to an encrypted stored pwd of course). Then you can select count and check if >0 or =1. I believe that would be slightly more efficient than looping over the result set.
    Nice example though.

  2. hi there!
    nice and great tutorials written by u..
    brother when i copy and paste the validate_login.php in dreamweaver cs5
    it show error for these two lines:
    if($row[‘users_email’]==$email && $row[‘users_pass’]==$pass) {
    echo’You are a validated user.’;
    echo’Sorry, your credentials are not valid, Please try again.’;
    ==================================================kindly note that there were no curly braces in the above line i add to it but Dreamweaver continuously showing error…
    I am a newly fresh php learner.
    ur help is needed…

    1. Hi Afi,

      I have just noticed a small error with ‘&&’ and ‘&’ I have fixed it, so give it a shot now. If error persists, let copy the error and write it down here.

  3. Hi Sir. I am currently working for our project and having trouble with logging in.
    Is there a php code were the user logged on, validated and will be directed to his/her own profile? Just like on a social network sites?

  4. Dear Jorge,
    I am getting this warning when I run the script.

    “Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\XAMPP\htdocs\login\test\validate_login.php on line 20
    Sorry, your credentials are not valid, Please try again.”
    I tried to fixed it many ways.. But I was failed..

    Please advise me to fix this…

    have a good day..!
    Vipula from Sri lanka

Leave a Reply

Your email address will not be published. Required fields are marked *

The qTranslate Editor has disabled itself because it hasn't been tested with your Wordpress version yet. This is done to prevent Wordpress from malfunctioning. You can reenable it by clicking here (may cause data loss! Use at own risk!). To remove this message permanently, please update qTranslate to the corresponding version.