Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $criteria = array('ctitle', 'csubject', 'creference', 'cat_id', 'cmaterial', 'ctechnic', 'cartist', 'csource', 'stolen');
- $likes = "";
- $url_criteria = '';
- foreach ( $criteria AS $criterion ) {
- if ( ! empty($_POST[$criterion]) ) {
- $value = ($_POST[$criterion]);
- $likes .= " AND `$criterion` = '%$value%'";
- $url_criteria .= '&'.$criterion.'='.htmlentities($_POST[$criterion]);
- } elseif ( ! empty($_GET[$criterion]) ) {
- $value = mysql_real_escape_string($_GET[$criterion]);
- $likes .= " AND `$criterion` = '%$value%'";
- $url_criteria .= '&'.$criterion.'='.htmlentities($_GET[$criterion]);
- }
- }
- $query = "SELECT * FROM collections WHERE c_id>0" . $likes . " ORDER BY c_id ASC";
- // then append the $url_criteria onto any of the hrefs you need to create for pagination, e.g.
- echo '<a href="myurl.php?page=1'.$url_criteria.'" title="Page 1">Page 1</a>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement