When I try to connect to my Godaddy Linux Shared Hosting account database, I get the following message:
Fatal error: Call to undefined function: mysqli_connect() in /home/content/c/c/s/ccsoundsystem/html/CMS/functions_main.inc on line 10
I have successfully installed MODx and ZenCart, so I pretty much understand how to find my hostname, username and password for the GoDaddy databases.
But, now I am trying to learn PHP from the ground up by using some pre-made “for Dummies” code which, so far, has proven to be a whopping piece of shit and I would like to personally strangle everyone involved in its publication.
Here’s the fine code from functions_main.inc which gives the above error:
<?php
/* Function: Connect_to_db
* Desc: Connects to a MySQL database. The name of
* a file containing the database variables
* is passed to the function.
*/
function Connect_to_db($filename)
{
include($filename);
$connection = mysqli_connect($host, $user,$passwd)
or die ("Couldn't connect to server.");
$db = mysqli_select_db($connection,$database)
or die ("Couldn't select database.");
return $connection;
}
?>
It uses a Vars.inc file which looks like this:
<?php
$host = "p32mysql22.secureserver.net";
$user = "killjanetvalade";
$passwd = "Password123";
$database = "killjanetvalade";
?>
Yes, Godaddy’s user and database names are the same. This happens automatically when you create a database and it has never been a problem.
The first bunch of code is presumably supposed to call the Vars.inc file to get the information (although, I don’t see where). Now, for some reason the functions_main.inc code has an error in line 10.
…and Line 10 is:
$connection = mysqli_connect($host, $user,$passwd)
And the error, once again, is…
Fatal error: Call to undefined function: mysqli_connect() in /home/content/c/c/s/ccsoundsystem/html/CMS/functions_main.inc on line 10
… “Undefined function?” …
Anyone know what the problem is before I go find and strangle Janet Valade and everyone at the “For Dummies” publication house? (joking, no need to call the police)
Thank you.
Signed,
A Dummy (for which this “For Dummies” book is clearly not intended!)