我有这个搜索功能与类别,当你点击这个类别,你将在该类别内搜索,但我想使它,使我能够在多个类别内搜索关键字。这是我的表格:
<form method="get" action="zoek.php">
<input type="text" name="producttitle" placeholder="Productnaam">
<input type="hidden" name="prodgroup" value="<?= (isset($_GET['prodgroup'])) ? $_GET['prodgroup'] : '' ?>">
<input type=submit class="btn btn-primary" value="Zoek...">
</form>
这是您单击类别并搜索单词的代码
<?php
if (isset($_GET['prodgroup']) && $_GET['prodgroup'] != "" && isset($_GET['producttitle']) && $_GET['producttitle'] != "") {
$category = $_GET['prodgroup'];
$prodtit = $_GET['producttitle'];
$query = $readconn->prepare("
SELECT S.StockItemID, S.StockItemName, S.Photo, S.UnitPrice, S.Photo, S.Brand
FROM stockitems S JOIN stockitemstockgroups SISG ON S.StockItemID = SISG.StockItemID
JOIN stockgroups SG ON SISG.StockGroupID = SG.StockGroupID
WHERE SG.StockGroupID = '" . $category . "'
AND S.StockItemName LIKE '%" . $prodtit . "%'
");
以下是带有id的类别: `.
49条答案
按热度按时间kuhbmx9i46#
---+
vc6uscn947#
-. | StockGroupID | Col2 | :
du7egjpx48#
---+
fd3cxomn49#
---+