Hi,
I want to re-use already estanbished DB connection but I don't know know how to do it. Please help me to modify my code below.
Thanks in advance
function connectDB(){
$host = "localhost";
$uid = "root";
$psw = "";
$db = "mydb";
$hostc = @mysql_connect($host, $uid, $psw);
if($hostc){
$dbc = mysql_select_db($db);
if(! $dbc){
return false;
} else {
return true;
}
} else {
return false;
}
}
$result = connectDB();
if($result === true){
echo "OK";
} else {
echo "NO";
}