close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

help with a mySQLi recordset

Thread began 3/02/2015 2:10 pm by Christopher West | Last modified 3/02/2015 3:59 pm by Christopher West | 1047 views | 6 replies

Christopher WestCommunity Expert

help with a mySQLi recordset

Hello there, I have a MySQLi recordset that takes in 2 URL parameters:

php:
?Department=&Category=



And I have a dropdown menu, so for example the Menu item 'Living' would be department and it would contain many categories. So that all works fine...however lets say on my homepage I have a info-graphic link for 'Living' so if the user clicks on that it will take them to the page that will display ALL categories items. How can i do this?

The example URL would be:

php:
category.php?Department=Living&Category=Occasional-Chairs



But lets say I have an infor-graphic link that directs to:

php:
category.php?Department=Living



My recordset is:

php:
<?php

if(true){
    
    switch(isset(
$_GET['Department'])?$_GET['Department']:""){
        
        case 
"New-Arrivals":
            
$rsProducts = new WA_MySQLi_RS("rsProducts",$ecartdb,0);
            
$rsProducts->setQuery("SELECT * FROM products WHERE ProductNewArrival = 1");
            
$rsProducts->execute();
        break;
        
        case 
"Best-Sellers":
            
$rsProducts = new WA_MySQLi_RS("rsProducts",$ecartdb,0);
            
$rsProducts->setQuery("SELECT * FROM products WHERE ProductBestSeller = 1");
            
$rsProducts->execute();
        break;
        
        case 
"InStore-Now":
            
$rsProducts = new WA_MySQLi_RS("rsProducts",$ecartdb,0);
            
$rsProducts->setQuery("SELECT * FROM products WHERE ProductInStoreNow = 1");
            
$rsProducts->execute();
        break;
        
        case 
"Search":
            
$rsProducts = new WA_MySQLi_RS("rsProducts",$ecartdb,0);
            
$rsProducts->setQuery("SELECT * FROM products");
            
            if (isset(
$_GET["Price"])) {
                
$prices explode(":",$_GET["Price"]);
                
$rsProducts->addFilter("ProductPrice",">=","d",$prices[0]);
                
$rsProducts->addFilter("ProductPrice","<=","d",$prices[1]);
            }
            
            
$productTypes = array();
            
                if (isset(
$_GET["Wood"])) {
                    
$productTypes[] = "Wood";
                }
                if (isset(
$_GET["Metal"])) {
                    
$productTypes[] = "Metal";
                }
                if (isset(
$_GET["Glass"])) {
                    
$productTypes[] = "Glass";
                }
                if (
sizeof($productTypes) > 0$rsProducts->addFilter("ProductType","=","s",$productTypes);
                if (isset(
$_GET["Product"])) {
                    
$productName $_GET["Product"];
                    
$splitName explode(" ",$productName);
                    for (
$x=0$x<sizeof($splitName); $x++) {
                        
$splitName[$x] = "%" $splitName[$x]."%";
                    }
                    
$rsProducts->addFilter("ProductKeywords","LIKE","s",$splitName);
                }
            
$rsProducts->setFilter();
            
$rsProducts->execute();
        break;
            
        default:
            
$rsProducts = new WA_MySQLi_RS("rsProducts",$ecartdb,0);
            
$rsProducts->setQuery("SELECT products.*, categories.* FROM products INNER JOIN categories ON products.ProductCategoryID = categories.CategoryID WHERE categories.CategoryLink = ? AND categories.CategoryLocation = ?");
            
$rsProducts->bindParam("s""".(isset($_GET['Category'])?$_GET['Category']:"")  ."""-1"); //WAQB_Param1
            
$rsProducts->bindParam("s""".(isset($_GET['Department'])?$_GET['Department']:"")  ."""-1"); //WAQB_Param2
            
$rsProducts->execute();
        break;
    }
}
?>



Regards

Chris

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...