I've been trying to get a php/mysqli simple search up and running, but i can't seem to get it working. I've been following some directions i found in an earlier question (Link) but it still won't work.
$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();
That results in this error message: "Wrong parameter count for mysqli_stmt::bind_param() in..."
Some advice or help would be appreciated.