I recently moved an app from using the older mysql funcions to using mysqli functions. The app connects to the DB on each request, and with the old functions you didn't need to pass in a DB connection, but with the new functions you do. I have placed the connection in the GLOBALS array to be used by my mysql library.
$GLOBALS['connection'] = mysqli_connect($host, $user, $pass, $db);
Question 1: Is there any reason not to do this?
Question 2: Everything seems to be working fine when I access the app, but Googlebot seems to be having trouble:
mysqli_real_escape_string() expects parameter 1 to be mysqli, null given
When the connection is being passed in from the $GLOBALS
array. Anny idea why Googlebot might cause the DB connection to not exist?