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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

convert search to access a mysqli recordset?

Thread began 8/31/2015 3:26 pm by Jamie | Last modified 8/31/2015 4:25 pm by Ray Borduin | 394 views | 1 replies |

Jamie

convert search to access a mysqli recordset?

not sure which way round I need to do this but am wanting to create a search form but the recordset for the products is mysqli - I am assuming that ideally I would need to convert the search function to access mysqli (rather than converting the existing recordset to the old style) recordset but unsure how to do this.

<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: ShopSearch;
//Searchpage: shopsearch.php;
//Form: shopSearch;
$WADbSearch1_DefaultWhere = "";
if (!session_id()) session_start();
if ((isset($_POST["WADbSearch1"])) && ($_POST["WADbSearch1"] != "")) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
$KeyArr0 = array("ProductSKU", "ProductName", "ProductPrice", "ProductLongDesc", "ManufacturerName", "CategoryName");

//comparison list additions
$WADbSearch1->keywordComparison($KeyArr0,"".((isset($_POST["shopSearchInput"]))?$_POST["shopSearchInput"]:"") ."","AND","Includes",",%20","%20","%22","%22",0);

//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_shopsearch"]=$WADbSearch1->whereClause;
}
}
else {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch1_shopsearch"]) && $_SESSION["WADbSearch1_shopsearch"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_Products"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>



and then updating the RS to take into acount the search

<?php
$maxRows_Products =12;
$Products = new WA_MySQLi_RS("Products",$DBConnection,$maxRows_Products);
$Products->setQuery("SELECT products.*, productmanufacturers.ManufacturerName , productcategories.CategoryName FROM products INNER JOIN productmanufacturers ON products.ProductManufacturerID = productmanufacturers.ManufacturerID INNER JOIN productcategories ON products.ProductCategoryID = productcategories.CategoryID WHERE products.ProductLive = 1 ORDER BY products.ProductOrder ASC");
$Products->execute();

$ProductsTotal = new WA_MySQLi_RS("ProductsTotal",$DBConnection);
$ProductsTotal->setQuery("SELECT count(1) a FROM products WHERE ProductLive = 1 ORDER BY ProductOrder ASC");
$ProductsTotal->execute();
$Products_Total = (int)$ProductsTotal->Results[0]['a'];
$Req_Pages = ceil($Products_Total/$maxRows_Products);
?>



thanks

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

This isn't supported in the current MySQLi code. I can help you this in our premier ticket today.

Sign in to reply to this post

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