Jump to content

Recommended Posts

I don't know if this is a hosting issue (with bluehost) or not. I checked the phpinfo and they're running php 5.2.16 on the server I'm on. And as far as I can tell, mysqli should be running fine. I have a few pages I'm running locally on my development machine and all runs well. But on the host's server I'm getting a connection failure error. I know my connect function is being run because when echo the $dbname and the other 3 parameters they show up on the page. Here's my connect function:

 

function getDBLink() {

 

include('/home1/mysite/private/config.php');

 

$link = mysqli_connect($dblocation, $dbuser, $dbpass, $dbname);

 

/* check connection */

if (mysqli_connect_errno()) {

printf("Connection failed: %s\n", mysqli_connect_error());

exit();

}

 

return $link;

 

}

 

I've spent hours rechecking the spelling on all the params to be sure of no typos. If I change mysqli_connect to mysql_connect, it does connect (but all the subsequent code using mysqli to query the tables fails). So it's a mysqli issue I'm thinking. I don't really want to change everything to mysql from mysqli if I don't have to. This should work.

 

Any ideas why I'd be having this problem? I'm not an expert at any of this. Hoping someone out there that is might see something I'm not seeing.

 

Link to comment
https://forums.phpfreaks.com/topic/227945-mysqli-and-bluehost-problem-maybe/
Share on other sites

Okay. Never mind. This is embarrassing. I must have been really blurry eyed earlier after working on this for so long. I found a typo in one of the connection parameters. It's working fine now. Should have waited 10 minutes longer before posting my question! LOL.

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.