My code appears to work just fine but from time to to time I have database connection errors or to many connections to my database which hangs my sites (every few month’s)
Does the code below look ok?
Thank you
Kevin…
<?php
$user_name = "myusername";
$password = "mypassword";
$database = "mydatabase";
$server = "mysql.myhost.com";
$db_handle = ($GLOBALS["connection"] = mysqli_connect($server, $user_name, $password));
$db_found = ((bool)mysqli_query( $db_handle, "USE " . $database));
if ($db_found) {
$SQL = "SELECT * FROM master WHERE ((name like '%".$SeachFor."%')) ORDER BY ccrandomnum DESC LIMIT 2000" ;
$result = mysqli_query($GLOBALS["connection"], $SQL);
?>
//my main code here
<?php
((is_null($___mysqli_res = mysqli_close($db_handle))) ? false : $___mysqli_res);
}
else
{
print "Database NOT Found ";
((is_null($___mysqli_res = mysqli_close($db_handle))) ? false : $___mysqli_res);
}
?>