I solved this by putting my connection include in a function called dbconnect()
Then I injected the function for the connection handle..
Like so
$theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string(dbconnect(), $theValue) : mysqli_escape_string(dbconnect(), $theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "''";
break;
*****************
Connection php file
<?php
function dbconnect()
{
$hostname_PrintSchedDataCn = 'localhost';
$database_PrintSchedDataCn = 'nothing';
$username_PrintSchedDataCn = 'nothing';
$password_PrintSchedDataCn = 'nothing';
$PrintSchedDataCn = mysqli_connect($hostname_PrintSchedDataCn, $username_PrintSchedDataCn, $password_PrintSchedDataCn, $database_PrintSchedDataCn) or trigger_error(mysqli_error(),E_USER_ERROR);
return $PrintSchedDataCn;
}
?>