我正在尝试开发我的网站,需要一些支持。所以我的网页搜索产品信息并返回适当的结果。当用户在搜索框中搜索关键字或产品标题并提交查询时,它工作得非常好,但现在获得的结果列表,我想要一个过滤器搜索用户可以根据价格、品牌、类别等过滤搜索结果。
我在 mysql 数据库中有两个表 1:product_info 列 productid、title、description、brand、category、price 2:product_image productid,imageid,imagename,image
请帮助我了解我应该如何开始这个过程。我在网上看过,他们对使用哪个脚本有多种建议,但我想使用最简单的方法,因为我对这一切都不熟悉。您可以提出与此主题相关的任何建议。谢谢:)
只是为了让您知道,对于单个搜索框,我使用了以下代码。
$query= "
SELECT *
FROM `product_info`
WHERE `title` LIKE '% ".$search_name." %'
OR `title` LIKE '% ".$search_name."'
OR `title` LIKE '".$search_name." %'
OR `title` = '".$search_name."'";
$query_run=mysql_query($query);
if(mysql_num_rows($query_run)>=1)
{
echo'Showing '.mysql_num_rows($query_run).' results for items with "'.$search_name.'" in the title:';
//the result is displayed in the table format.
}