PHP自定义错误问题

Currently, I have this code:

<?php
if (isset($_GET['s'])) {
    $itemid = $_GET['s'];
    $search = "$itemid";
    $query  = ucwords($search);
    echo "<title>Results for $query</title>";
    $string = file_get_contents('http://clubpenguincheatsnow.com/tools/newitemdatabase/items.php');
    if ($itemid == "") {
        echo "Please fill out the form.";
    } else {
        echo '<div id="content">';
        $string = explode('<br>', $string);
        foreach ($string as $row) {
            preg_match('/^(.+)\s=\s(\d+)\s=\s(\D+)\s=\s(\d+)/', trim($row), $matches);
            if (preg_match("/$query/i", "$matches[1]")) {
                echo "<a href='http://clubpenguincheatsnow.com/tools/newitemdatabase/info.php?id=$matches[2]'>";
                echo $matches[1];
                echo "</a><br>";
            }
        }
        echo '</div>';
    }
} else {
    echo "Item does not exist!";
}
?>

If "$matches[1]" has nothing in it, I want my code it to echo "Item does not exist!" How do I do this though? Please help!

I've tried something like if ($matches[1]=="") { echo "Item does not exist!"; } before, but it didn't work. This is what I got:

http://img685.imageshack.us/img685/998/28990b2c12d0423292d3574.png

See works fine right? Look what happens if $matches[1] DOES exist:

http://img528.imageshack.us/img528/3690/71472c9de6ec49118ee8d48.png

It still comes up! How can I make my code so it only echos the error if there is nothing for $matches[1]? PLEASE HELP ME!

If you are wondering, this is my code when I added the if ($matches[1]=="") { echo "Item does not exist!"; } in:

<?php
if (isset($_GET['s'])) {
    $itemid = $_GET['s'];
    $search = "$itemid";
    $query  = ucwords($search);
    echo "<title>Results for $query</title>";
    $string = file_get_contents('http://clubpenguincheatsnow.com/tools/newitemdatabase/items.php');
    if ($itemid == "") {
        echo "Please fill out the form.";
    } else {
        echo '<div id="content">';
        $string = explode('<br>', $string);
        foreach ($string as $row) {
            preg_match('/^(.+)\s=\s(\d+)\s=\s(\D+)\s=\s(\d+)/', trim($row), $matches);
            if (preg_match("/$query/i", "$matches[1]")) {
                echo "<a href='http://clubpenguincheatsnow.com/tools/newitemdatabase/info.php?id=$matches[2]'>";
                echo $matches[1];
                echo "</a><br>";
            }
        }
        echo '</div>';
        if ($matches[1] == "") {
        echo "Item does not exist!";
        }
    }
} else {
    echo "Item does not exist!";
}
?>

Any help to my question would be VERY HIGHLY APPRECIATED!

Look at PHP's comparison operators

if (empty($matches[1])) { echo "Item does not exist!"; }
else { 
    echo "Item does not exist!"; 
} 

This "else" is in regards to isset($_GET['s']). Is there a variable called s in your query string? If there isn't, then it's normal that you get the message.

Maybe you put that else block in the wrong place?