搜索工作正常,只显示第一个结果

Title should make the problem clear. The search function works as intended, but what should be the first hit will not show at all and i don't know why. Here's the code:

<form action="admin_orders_search.php" method="GET">
<input type="text" name="query" value="Search"/>
</form>

<?php
$query = $_GET['query'];

$query = htmlspecialchars($query); 

$query = mysql_real_escape_string($query);

$sql = "SELECT * FROM orders WHERE 1";
$matches = preg_split('/\s+/',$query);
foreach($matches as $match){
$sql .= " AND `ship_eta` LIKE '%".$match."%'";
}
$raw_results = mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($raw_results) > 0){ 

    while($results = mysql_fetch_array($raw_results))
    {

// ---- RESULTS START ---->

$res=mysql_query("select * from orders ".$qry." order by id desc ");
while($row=mysql_fetch_array($raw_results))
{ ?>

// here are the hits shown

}

// ---- RESULT END ---->

   }

}
else{ 
    echo "No hits";
}
?>

In the code:

$res=mysql_query("select * from orders ".$qry." order by id desc ");
while($row=mysql_fetch_array($raw_results))
{
//results here
}

You still use the variable $raw_results. I think you want to use the variable $res since you already have a while with the $raw_results

Ive found some unused lines in the code and after removing them it works! The affected lines are these:

...
if(mysql_num_rows($raw_results) > 0){

// ---- RESULTS START  ----> 

while($row=mysql_fetch_array($raw_results))
{ ?>

// here are the hits

}

// ---- RESULT END ----> 

}
else{ 
    echo "No hits";
}

}
else{ 
echo "error: ".$min_length." needed minimum!";
}
?>

// ---- SEARCH END ---->
<?php 
}
}
?>