I'm getting this message several times:
Error establishing a connection to the Database
IhavereadsomematerialaboutthisproblemandalwaysthesolutionistoverifytheWP-configfileandverifythattheMYsqlusernameandpasswordarecorrectandcorrect.
IsthereanyotherwaytocheckwhatmaybeoverloadingMysql?
Inmythemeintheindex.phpfile,Iaddedthecodebelow:
<?phpechocatch_that_image(25,14)?>
andintheotherfunction.phpfile:
functioncatch_that_image($w,$h){global$post,$posts;$first_img='';$new_img_tag="";
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image with 0 width
$new_img_tag = "<img src='/images/noimage.jpg' width='0px' class='' />";
}
else{
$new_img_tag = '<img alt=" - ' . $post->post_title . ' - " title="' . $post->post_title . '" src="' . $first_img . '" width="' . $w . '" height="' . $h . '" class="" />';
}
return $new_img_tag;
}
This code is for calling images hosted outside of wordpress and displaying them in the theme.
Is this code related to the Mysql error?