converting a rs to allow my pagination to work
Hey Ray
Have set up a results page - in the first instance, content is filtered by 'productcategories' and want to add pagination using the below rs but I cannot get the select statements correct in the 2nd code block below (the first code block works fine without my pagination)
So I want to 'convert' this
<?php
$Categories = new WA_MySQLi_RS("Categories",$DBConnection,0);
$Categories->setQuery("SELECT productcategories.*, productcategories_2.CategoryName AS parentcategoryname, productcategories.CatPermalink, productcategories_2.CatPermalink AS parentpermalink, products.* FROM productcategories LEFT OUTER JOIN productcategories AS productcategories_2 ON productcategories_2.CategoryID = productcategories.CategoryParentID LEFT OUTER JOIN products ON products.ProductCategoryID = productcategories.CategoryID AND products.ProductLive = 1 WHERE productcategories.Live = 1 AND productcategories.CatPermalink = ? ORDER BY products.ProductDate ASC");
$Categories->bindParam("s", "".$_GET["perm"] ."", "-1"); //permparam
$Categories->execute();
?>
to this
<?php
$maxRows_Categories =15;
$Categories = new WA_MySQLi_RS("Categories",$DBConnection,$maxRows_Categories);
$Categories->setQuery("SELECT ");
$Categories->bindParam("s", "".$_GET["perm"] ."", "-1"); //permparam
$Categories->execute();
$CategoriesTotal = new WA_MySQLi_RS("CategoriesTotal",$DBConnection);
$CategoriesTotal->setQuery("SELECT count(1) a");
$CategoriesTotal->execute();
$Categories_Total = (int)$CategoriesTotal->Results[0]['a'];
$Req_Pages = ceil($Categories_Total/$maxRows_Categories);
?>
Am also trying to get the recordset to allow me to show alternate content if the category holds 0 products
Thanks
Jamie