从数据库获取值会产生404错误

whenever I try to get the value from the database and echo it the page will be shown as a 404 error code, what should I do?

The Code:

<?
$mysqli222 = mysqli_connect('HIDDEN', 'HIDDEN', 'HIDDEN', 'HIDDEN');
$result2222 = $mysqli222->query("SELECT HIDDEN1 FROM HIDDEN2 WHERE urlcode = '$MyValue1'");

         if($result2222->num_rows == 0) {
            echo 'ERROR!';
         }else{
             //header("location: $OriginalURL");
                    $MyValue2 = $result2222;
                    echo $MyValue2;
            }
?>

404 error is not related to db. It is related to web server and browser throws back 404 error, if it doesn't find the url you are requesting. So, the possible reason is that you are trying to follow a broken or dead link.