Php 搜索结果错误

Php 搜索结果错误,php,mysql,search,Php,Mysql,Search,这是我的搜索查询,如果没有结果匹配,如何显示错误, 请帮忙 $sql="SELECT * FROM course WHERE course_name LIKE '%" . $search_name . "%'"; //-run the query against the mysql query function $result=mysql_query($sql); $sql=“从课程中选择*,其中课程名称类似“%”$搜索你的名字。

这是我的搜索查询,如果没有结果匹配,如何显示错误, 请帮忙

 $sql="SELECT  * FROM course WHERE course_name LIKE '%" . $search_name .  "%'";
              //-run  the query against the mysql query function
              $result=mysql_query($sql);
$sql=“从课程中选择*,其中课程名称类似“%”$搜索你的名字。"%'";
//-对mysql查询函数运行查询
$result=mysql\u查询($sql);
if(mysql_num_rows($result)<1)
{
echo“没有结果”;
}
$sql=“从课程中选择*,课程名称如“%”$搜索你的名字。"%'";
//-对mysql查询函数运行查询
$result=mysql\u查询($sql);
if(mysql_num_rows($result)<1)
{
echo“没有结果”;
}
$sql="SELECT  * FROM course WHERE course_name LIKE '%" . $search_name .  "%'";
              //-run  the query against the mysql query function
$result=mysql_query($sql);

if(mysql_num_rows($result) < 1)
{
    echo 'There were no results.';
}
if(mysql_num_rows($sql)=="0")
{
echo "----------------"; //your code here
}