php - Code failing to pass query criteria to URL -
my problem since added switch function code quering cat_id code can no longer pass query criteria url paginating. cat_id categoryid saved foreign key in child table.
here code if can help:
$criteria = array('ctitle', 'csubject', 'creference', 'cat_id', 'cmaterial', 'ctechnic', 'cartist', 'csource', 'cposture', 'stolen'); $likes = ""; $url_criteria = ''; foreach ( $criteria $criterion ) { if ( ! empty($_post[$criterion]) ) { $value = ($_post[$criterion]); $likes .= " , `$criterion` '%$value%'"; switch ($criterion) { case 'cat_id': $likes .= " , `$criterion`='$value'"; break; default: $likes .= " , `$criterion` '%$value%'"; break; $url_criteria .= '&'.$criterion.'='.htmlentities($_post[$criterion]); } } elseif ( ! empty($_get[$criterion]) ) { $value = mysql_real_escape_string($_get[$criterion]); $likes .= " , `$criterion` '%$value%'"; switch ($criterion) { case 'cat_id': $likes .= " , `$criterion`='$value'"; break; default: $likes .= " , `$criterion` '%$value%'"; break; $url_criteria .= '&'.$criterion.'='.htmlentities($_get[$criterion]); } //var_dump($likes); } } $sql = "select * collections c_id>0" . $likes . " order c_id asc";
$url_criteria .= '&'.$criterion.'='.htmlentities($_post[$criterion]);
this after
default: ... break;
so never executed.