Jump to content

Error Establishing A Database Connection


ekorenz

Recommended Posts

  • 1 month later...

You can set "display_errors" and "error_reporting" to "on" to analyse the problem.

Like these:

<?php
ini_set('display_errors', 1); // Displays the errors
error_reporting(E_ALL); // Turns on all errors (E_NOTICE, E_WARNING, E_STRICT, ETC) happening on your script
$con = mysql_connect("username","password","localhost","user_database") or die(mysql_error($con)); // These will try to connect to database using details. If it couldn't connect then prints the error
/*** OTHER THINGS YOU WANT TO DO ->> ***/
?>

After your problem was solved you can turn off

Like these:

<?php
ini_set('display_errors', 0); // Displays the errors
error_reporting(E_NONE); // Turns off all errors (E_NOTICE, E_WARNING, E_STRICT, ETC) happening on your script
$con = mysql_connect("username","password","localhost","user_database"); // These will try to connect to mysql, if it fails then nothing happens
/*** OTHER THINGS YOU WANT TO DO ->> ***/
?>

Link to comment
Share on other sites

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.   Paste as plain text instead

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