OO MYSQL

So this is my first project and I’m new to php/mysql so I may have termonology wrong.

I made my project and it worked on my localhost on my computer. However, when I tried to put it online I incountered some errors. The main one is that it could not find the mysqli class. I think this is because my host has a php version of lower than 5.

my connection function was…

function dbconnect()
{
$result = mysql(‘localhost’, ‘oasisdes_admin’, ‘robdan91’, ‘oasisdes_project’);
if(!$result)
{
echo “Could not connect to database.”;
exit;
}
return $result;
}

I got the error…

Fatal error: Call to undefined function: mysqli() in /…/db_fns.php on line 4

However, when I used mysql_connect() it worked. The problem is that I don’t want to use a procedural approach. Is there a way I can use an OO approach before or equal to version 4.4.6.

Nevermind, I was able to update my host’s version

Sponsor our Newsletter | Privacy Policy | Terms of Service