
 lc - 2009-11-12 08:23:34
Hi,
I have applied this paging script in one of my application. But i am facing a problem. Suppose i have two pages search.php & searchresult.php.
In search.php i have given user to search for assignments in category.
This data is posted to searchresult.php in which i have applied the pagination script.
My code of searchresult.php
if($_POST['cmbSearchin']=='category' && $_POST['rdbFor']=='assignment')
{
			$sqlForCategories = "
			SELECT
				tbl_categories.title as categorytitle,
				tbl_categories.pk_categoryid as categoryid,
				count(tbl_assignments.pk_assignmentid) as totalassignments
			FROM
				tbl_categories
			LEFT JOIN tbl_assignments
				on ( tbl_categories.pk_categoryid = tbl_assignments.fk_tbl_categories_categoryid )
			WHERE
				tbl_categories.title LIKE '%".$_POST[txtSearchString]."%'
			GROUP BY
				categoryid
			";
 			$categories=$objdb->customQuery($sqlForCategories, false);
			if($categories)
			{
			foreach($categories as $category)
					{
						$categoryid.=$category[categoryid].",";
					}
			$categoryid=trim($categoryid,',');
 			$sqlforAssignments="
			SELECT 
    			tbl_categories.title as category, 
    			tbl_assignments.title, 
				tbl_assignments.pk_assignmentid as assignmentid,
    			tbl_assignments.description, 
    			tbl_assignments.location, 
    			tbl_assignments.type 
			FROM 
    			tbl_assignments 
			INNER JOIN 
    			tbl_categories 
    			ON (tbl_assignments.fk_tbl_categories_categoryid = tbl_categories.pk_categoryid) 
			WHERE 
    			tbl_assignments.fk_tbl_categories_categoryid IN (".$categoryid.")";
			require_once(APP_PHYSICAL_PATH."classes/paging.php");
			$paging = new PAGING($sqlforAssignments,10,3);
			$sqlforAssignments = $paging->sql;
			$assignments = $objdb->customQuery($sqlforAssignments,false);
			$assignments = cleanValues($assignments);
			}
	
}
and echo $paging->show_paging(APP_URL."views/searchresult.php", $params);
Suppose i have 15 records, firstly 10 records are displayed & then there is a link for page 2. Clicking on this displays blank page instead of 5 records.
How can i pass the post variables to $params and $sqlforAssignments is a join query, i am not sure it will work or not?
Please help
Thanks,
Pankaj