I am trying to convert an old site to use mysqli rather than mysql. Hit a bit of a stumberling block with this section of code if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($theValue) : mysqli_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } I keep getting the errors Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in C:\xampplite\htdocs\games\test.php on line 15 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in C:\xampplite\htdocs\games\test.php on line 15 If I add a connection like this $theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($games,$theValue) : mysqli_escape_string($games,$theValue); get the error Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in C:\xampplite\htdocs\games\test.php on line 12 Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in C:\xampplite\htdocs\games\test.php on line 12 Could someone please tell me what I am doing wrong Many thanks
... View more