Search engine

Hello! I am making a search engine, but i’m getting a small problem.
[php]
$search=$_POST[‘search’];
$sql = “SELECT * FROM players WHERE name LIKE ‘%$search%’ OR email LIKE ‘%$search%’ ORDER BY name ASC”;
$query = mysql_query($sql) or die(mysql_error());
$row_sql = mysql_fetch_assoc($query);
$total = mysql_num_rows($query);

if($total>0)
{
while ($row_sql = mysql_fetch_assoc($query)){
echo “<a href=’/&”;
echo $row_sql[‘name’];
echo “.php’>”;
echo $row_sql[‘name’];
echo “
”;
}
}
else
{
echo “No results”;
}
[/php]

The problem i’m getting is that whenever i search something, the first search result does’nt get displayed.
For example: I have 4 possible results, Test1, Test2, Test3 and Test4. When i type “test” in the search input, i only get test2, test3 and test4 as a result. And when i only type 3 it displays none but not the “No results” echo.
It’s probably very simple but i just cant fgure it out.

Thanks in advance!

-SOLVED-

Sponsor our Newsletter | Privacy Policy | Terms of Service