1

我只是将 3 个值传递给 URL,在测试时我试图将它们回显到屏幕上,但它只会回显每个值一次,即使我已将其设置为在各个点回显。一旦我逃避了它不会让我回应它的价值。为什么是这样?

<?php
    session_start();
    if (isset($_SESSION['SESSION_C']) && ($_SESSION['SESSION_C']==true))
    {
        $getyear = $_GET["Year"];
        echo $getyear; (IT WILL ECHO AT THIS POINT)
        $getyear = mysql_real_escape_string($getyear);
        echo $getyear; (BUT WONT ECHO HERE)

        $getsite = $_GET["Site"];
        echo $getsite;
        $getsite = mysql_real_escape_string($getsite);
        echo $getsite;
        $getsite = str_replace(' ', '', $getsite);
        echo $getsite;

        $getdoc =  $_GET["Doc"];
        echo $getdoc;
        $getdoc = mysql_real_escape_string($getdoc);
        echo $getdoc;
    }   
    else 
    {
        echo "sessionerror";
    }
?>
4

1 回答 1

4

mysql_real_escape_string()需要打开与 mysql 的连接。否则它将返回false。我猜var_dump($getdoc);会给你boolean(false)

您必须mysql_connect()在该代码之前致电。

于 2013-04-25T22:33:39.613 回答