mysqli_real_escape_string()只需要2个参数

时间:2017-05-31 09:51:10

标签: php mysqli

从mysql转换为mysqli仍然只是完成工作的最后一个动作,但我对mysqli_real_escape_string()和错误响应消息感到有点困惑

<?php 
require_once('Connections/greek.php'); 
?> 
<?php
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($greek, $theValue) : mysqli_escape_string($theValue);

break...

<?php
mysqli_free_result($kat_menu);

mysqli_free_result($MT_films_ST_peoplefilms);
?>

连接是

<?php
header('Content-Type: text/html; charset=utf-8');

$hostname_greek = "localhost";
$database_greek = "";
$username_greek = "";
$password_greek = "";
$greek = mysqli_connect($hostname_greek, $username_greek, $password_greek) or trigger_error(mysqli_error($greek),E_USER_ERROR); 
mysqli_select_db($greek, $database_greek);
mysqli_query($greek,"SET character_set_results=utf8");
    mb_language('uni'); 
    mb_internal_encoding('UTF-8');
 #mysqli_query($greek,"set names 'utf8'");

?>

根据PHP和mysqli手册

mysqli_real_escape_string ($link, $string)

正如代码所示,我将它们传递为($ greek,$ theValue),但它再次响应:注意:未定义变量:greek

有人能帮我解决这个让我觉得失明的错误吗?

0 个答案:

没有答案