这是我的搜索查询,如果没有结果匹配,我该如何显示错误,请帮助
$sql="SELECT * FROM course WHERE course_name LIKE '%" . $search_name . "%'";
//-run the query against the mysql query function
$result=mysql_query($sql);
$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
}