PHP function to access database

Hi

you guys know the basic SQL database connection thing right? this:
$host = “”;
$user = “”;
$password = “”;
$database = “”;
mysql_connect($host, $user, $password, $database);

my question is how can I use this in a function

function oConnect ( what should I write here? )
{
what should I put here ?
}

That isn’t the basic sql thing. That is the wrong way. Look at pdo, it has examples using functions and classes.

Try studying a bit. Here is a place to start…

http://www.w3schools.com/php/php_mysql_connect.asp

Sponsor our Newsletter | Privacy Policy | Terms of Service