我一直在尝试启动并运行 php/mysqli 简单搜索,但我似乎无法让它工作。我一直在遵循我在较早的问题(Link)中找到的一些指示,但它仍然无法正常工作。
$sql = 'SELECT product_title FROM product ';
$where = array();
$values = array();
$types = '';
if (isset($_GET['searchText']) and $_GET['searchText'] != '') {
$where[] = 'WHERE product_title = ?';
$values['titel'] = $_GET['searchText'];
$types .= 's';
}
if (isset($_GET['searchCategorySelect']) and $_GET['searchCategorySelect'] != '') {
$where[] = 'WHERE product_categoryid = ?';
$values['category'] = $_GET['searchCategorySelect'];
$types .= 's';
}
$sql .= implode(' AND ',$where);
$values = array_unshift($values, $types);
$search_stmt = $mysqli->prepare($sql);
$search_stmt->bind_param($values);
$search_stmt->execute();
这会导致此错误消息:“mysqli_stmt::bind_param() in... 的参数计数错误”
一些建议或帮助将不胜感激。