Jump to content

Can't connect to mysql server


Go to solution Solved by Pr0t0n,

Recommended Posts

Hey guys,

 

I am having problems when I started a class for mysql queries, and I am trying to connect in the __construct() but it doesnt matter how many diffrent servers I try it won't freaking connect PLEASE HELP lol.

 

Code is below:

function __construct() {
       
    $db 	= new mysqli($db_login_cred);
//    $db_conn	= mysqli_connect() or die(mysqli_error($db));
 
 if (mysqli_connect_error()) {
    die('Connect Error (' . mysqli_connect_errno() . ') '
            . mysqli_connect_error());
}

echo 'Success... ' . $db->host_info . "\n";
    
/*
    if(isset($db_conn)) {
	echo "Verbinding met de MySQL backend tot stand gebracht.";
    } else {
	echo "Kan de MySQL-backend niet bereiken.<br /><br />
	      Foutmelding:<br />"
	     .$error = $db_conn->mysqli_connect_error()
	     .$error;
    }
*/

There's some of my own code which is commented out in a try to use standard code from php.net to see if I made a typo or whatever.

 

 

I will keep this page open so if u need additional info I can supply it fast hopefully.

 

if u also want to see the output: http://odins.co.nf/

Link to comment
https://forums.phpfreaks.com/topic/285723-cant-connect-to-mysql-server/
Share on other sites

I know why you're saying that but I came from four credentials and kept adding to be sure hes not using a wrong setting.

 

See this: http://nl3.php.net/manual/en/mysqli.construct.php and scroll to "Parameters" u will see all the parameters u can add to it.

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.