Suggested articles for you:

29 thoughts on “Complete Login and Registration Application using PHP and MySQL

      1. Anvesh

        Warning: mysqli_connect(): (HY000/1049): Unknown database ‘loginsystem’ in C:\wamp64\www\anvesh\includes\dbh.inc.php on line 8

        Reply
        1. Ravi Bandakkanavar Post author

          Hi,

          Its failing at $conn = mysqli_connect($serverName, $dBUsername, $dBPassword, $dBName, 3306);
          Do verify your MySQL server’s credentials.

  1. Yushiko

    Warning: mysqli_connect(): (HY000/1045): Access denied for user ‘root’@’localhost’ (using password: YES) in C:\xampp\htdocs\Complete-Login-and-Registration\includes\dbh.inc.php on line 8
    Connection failed: Access denied for user ‘root’@’localhost’ (using password: YES)

    what do i change in the code?

    Reply
    1. Ravi Bandakkanavar Post author

      Hi Yushiko,

      What is the username and password for your MySQL application? You need to add the same details in the connection string.

      Reply
  2. rakshitha

    hi
    I am getting following error

    *website error. contact admint to have it fixed

    could you please help me

    Reply
    1. Ravi Bandakkanavar Post author

      Hi Rakshitha,

      As you can see in the code, this error is thrown when SQL exception is raised. You have to verify the MySQL server’s credentials and database name. It should work after that.

      Reply
  3. Fred

    Thanks for these great script. Bravo.
    I got the following error when i click on the edit profile button:

    Notice: Use of undefined constant TITLE – assumed ‘TITLE’ in C:\xampp\htdocs\loginsystem\edit-profile.php on line 2

    Reply
    1. Ravi Bandakkanavar Post author

      Hi Fred,

      Sorry about that. Could you please try commenting the second line. The following line

      define(TITLE, “Edit Profile”);

      Reply
  4. Darryl Santmayor

    Hey im getting an error “Warning: mysqli_connect(): (HY000/1045): Access denied for user ‘root’@’localhost’ (using password: NO) in C:\xampp\htdocs\log\includes\dbh.inc.php on line 8
    Connection failed: Access denied for user ‘root’@’localhost’ (using password: NO)”

    I created loginsystem database but can u give the sql code for table creation.

    Reply
    1. Ravi Bandakkanavar Post author

      Hi Darryl,

      Where are you executing this one?
      Please make the following change in dbh.inc.php and try.

      $dBPassword = “”; //Database password

      Reply
  5. DOHNA A S

    i want to download the complete project source code link please

    Reply
  6. Robert

    Hi Ravi,

    thanks for a nice tutorial! Regarding the registration process, can you add e-mail validation, i.e. the visitor needs to validate his/her e-mail (using a link with a token) before he/she can gain access?

    Reply
    1. Ravi Bandakkanavar Post author

      Thanks Robert. You are proposing a good extension to the registration process. It needs a tweak in the table to include an additional column to track the email activations.
      I will either add it in the same process or try to write a separate post for the same.

      Reply
  7. Rocky Edwards

    this is a very good tutorial but how could I make it where whoever logins has a personal page like background and other personal links to other pages based on their login credentials

    Reply
  8. t3ch_guru

    this is great but how can you add a personal page for the user login like if they have a custom background picture and links or icons on their personal page instead of everyone accessing the same index.php that shows nothing

    Reply
  9. charles

    Thanks for the tutorial. I’m new to php; please kindly help me on how to link the files. Do I create several page templates for the “.inc.php” files?.

    Reply
      1. Charles

        Hello Ravi,
        Thanks for your prompt response to my last mail. But you haven’t uploaded the project zip as promised. There seems no download link to this tutorial. Please help…

        Reply

Did it help? Comment here..