close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

converting a rs to allow my pagination to work

Thread began 7/15/2019 7:55 am by Jamie | Last modified 7/18/2019 7:39 am by Jamie | 999 views | 5 replies

Jamie

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

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...