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.