Try to do the following way:
$sql="SELECT * FROM course_participant WHERE name like '%".$searchname."%'"; //Select Query
$result = mysql_query($sql); //execute the query and get the result
if(mysql_num_rows($result) > 0) //If there is a result, display it
{
echo "The search results are:<br />";
while ($row = mysql_fetch_assoc($result)) {
echo $row['name']."<br />";
}
}
else // If no result found
{
echo "No result found!"; //Display the "not found" mesasge
}
Reputation Points: 16
Solved Threads: 17
Junior Poster in Training
Offline 87 posts
since Dec 2009