View Single Post
Old 05-18-2009, 03:50 AM   #1 (permalink)
vixxy
The Visitor
 
Join Date: May 2009
Posts: 2
Thanks: 0
vixxy is on a distinguished road
Default Preventing mysqli errors from showing

Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2003): Can't connect to MySQL server on 'mysql7.......' (111) in /home/....t/defaults/co.php on line 8
and
Warning: mysqli_query() [function.mysqli-query]: Couldn't fetch mysqli in /home/..../co.php on line 18

Anyway how i can prevent these errors from showing up my on my site? In my file (co.php), i have this:
PHP Code:
mysqli_report(MYSQLI_REPORT_OFF);
$dbcon = new mysqli($server,$user,$pass,$db); 
I have tried these various codes:
PHP Code:
if (!$dbcon) {
    die(
'Server Error');
}
if (
$dbcon->ping()) {
 die(
'Server Problem');
}
if (
mysqli_connect_error()) { die('Connect failed1'); } 
if (
mysqli_connect_errno()) { die('Connect failed2'); } 
and yet, none of them is currently able to make mysqli shut up when it cant connect
vixxy is offline  
Reply With Quote