close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Advanced Search

Thread began 10/14/2017 1:25 pm by markdoyle87077 | Last modified 10/17/2017 1:56 pm by markdoyle87077 | 45 views | 4 replies

markdoyle87077

Advanced Search

Hi Ray,

We worked through this together on a premium ticket and it works fine

<?php
$searchrs_products_WADbSearch1 = new WA_MySQLi_Search("rs_products","");
if (isset($_SESSION["keywords"])) {
$searchrs_products_WADbSearch1->clearSearch();
$searchrs_products_WADbSearch1->setSearch(array("type"=>"k", "comparison"=>"like", "join"=>"and", "and"=>" ", "or"=>", ", "end_encap"=>"'", "start_encap"=>"'"),array("products.itemnumber", "products.supplieritemnumber", "products.description", "products.german_description", "products.supplier", "products.barcode"),"c",$_SESSION["keywords"]);
}
?>
<?php
$rs_products = new WA_MySQLi_RS("rs_products",$dmbc_database,200);
$rs_products->setQuery("SELECT id, itemnumber, german_description, selling_quantity, stockstatus, stock, packed FROM products ORDER BY description ASC");
$rs_products->execute();
?>

I now want to use CONCAT(suppler, ' ', description) AS search1 in the recordset so that I can search for products by supplier and description so I have modified the code to:

<?php
$searchrs_products_WADbSearch1 = new WA_MySQLi_Search("rs_products","");
if (isset($_SESSION["keywords"])) {
$searchrs_products_WADbSearch1->clearSearch();
$searchrs_products_WADbSearch1->setSearch(array("type"=>"k", "comparison"=>"like", "join"=>"and", "and"=>" ", "or"=>", ", "end_encap"=>"'", "start_encap"=>"'"),array("products.itemnumber", "products.supplieritemnumber", "products.description", "products.german_description", "products.supplier", "products.barcode", "products.search1"),"c",$_SESSION["keywords"]);
}
?>
<?php
$rs_products = new WA_MySQLi_RS("rs_products",$dmbc_database,200);
$rs_products->setQuery("SELECT CONCAT(supplier, description) AS search1, id, itemnumber, description, german_description, selling_quantity, stockstatus, stock, packed FROM products ORDER BY description ASC");
$rs_products->execute();
?>

When I search for products PHP throws an error:

SELECT CONCAT(supplier, description) AS search1, id, itemnumber, description, german_description, selling_quantity, stockstatus, stock, packed FROM products WHERE ((`products`.`itemnumber` like ? AND `products`.`itemnumber` like ?) OR (`products`.`supplieritemnumber` like ? AND `products`.`supplieritemnumber` like ?) OR (`products`.`description` like ? AND `products`.`description` like ?) OR (`products`.`german_description` like ? AND `products`.`german_description` like ?) OR (`products`.`supplier` like ? AND `products`.`supplier` like ?) OR (`products`.`barcode` like ? AND `products`.`barcode` like ?) OR (`products`.`search1` like ? AND `products`.`search1` like ?)) ORDER BY description ASC

Unknown column 'products.search1' in 'where clause'

Can you help me resolve this.

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