I am getting the following errors when I search on "All Catergories" in a shopping cart application. Searching on specific categories is fine although.
Warning: reset(): Passed variable is not an array or object in /home/gty/public_html/search.php on line 22
Warning: Variable passed to each() is not an array or object in /home/gty/public_html/search.php on line 23
Warning: Cannot modify header information - headers already sent by (output started at /home/gty/public_html/search.php:22) in /home/gty/public_html/includes/functions.php o
n line 51
Here is my code:
Code: Select all
function search_by_cat ($cat_id, $query)
{
global $txt, $tpl_block, $sub_cat;
global $subcatid;
$sql_where_cat = ''; $sql_where_title = ''; $i = 0; $old_c = '';
// search subcat_id
reset ($sub_cat[$cat_id]); //THIS IS LINE 22
while (list ($key, $val) = each ($sub_cat[$cat_id])) //AND LINE 23
$sql_where_cat .= "cat_id = '$key' OR ";
$sql_where_cat = substr ($sql_where_cat, 0, -3);Regards
Marcus