Jump to content

Different error messages in connection mysqli script.


LeonLatex

Recommended Posts

Sets up a mysqli connection script which I retrieve with included. If a user enters the wrong password or username then the connection to the database will be interrupted, and a message will be given about this.

I want to do this in a different way. I want the .php connection script to work so that the script lets me or the ser know if it is the password that is incorrect or the username that is not authenticated. This way the user can find out if he / she has entered the wrong password or username. If both are incorrect, notice of this will be given. connection file is a fairly standard script. I have no clue about how to solve this problem. Is it posible at all? Do you know how to do it? 

 

<?
$servername = "localhost";
$username = "username";
$password = "password";

// Oppretter tilkobling.
$conn = new mysqli($servername, $username, $password);

// Kontrollerer tilkoblingen.
if ($conn->connect_error) {
  die("Tilkoblingen feilet: " . $conn->connect_error);
}
echo "Tilkoblingen var vellykket";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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