$ _GET或转义字符串是不可预测的。 请解释?

i simply pass 3 values to the URL and while testing i was trying to echo them back to the screen but it will only echo each value once even though i have set it to echo at various points. once i escape the value it wont let me echo it. Why is this?

<?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";
    }
?>

mysql_real_escape_string() requires a open connection to mysql. Otherwise it will return false. I guess var_dump($getdoc); will give you boolean(false).

You'll have to call mysql_connect() before that code.