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