close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

MySQLi query with more than one word in a parameter

Thread began 8/27/2020 10:22 am by Janet | Last modified 8/27/2020 1:55 pm by Janet | 314 views | 3 replies

Janet

MySQLi query with more than one word in a parameter

I have a MySQLi query that uses a parameter from a search field on a previous page. It works well with one word searches, but I would like it to search on multiple words if the user adds them. I have seen where you can do that with MySQL (https://stackoverflow.com/questions/30029537/search-multiple-words-in-mysql has some examples) but I have no clue how to transpose that to my query. I would be very grateful for any advice the community can offer.

My query is (and there is probably a neater way of doing this too);

<?php
$DETAILS = new WA_MySQLi_RS("DETAILS",$iPage2,0);
$DETAILS->setQuery("SELECT * FROM business_list WHERE CATEGORIES LIKE ? OR DETAILS LIKE ? OR COMPANY LIKE ? OR COVID_BLURB LIKE ? AND SHOW_ON_WEB = 'YES'");
$DETAILS->bindParam("s", "%".(isset($_POST['param'])?$_POST['param']:"") ."%", "-1"); //colname
$DETAILS->bindParam("s", "%".(isset($_POST['param'])?$_POST['param']:"") ."%", "-1"); //colname 2
$DETAILS->bindParam("s", "%".(isset($_POST['param'])?$_POST['param']:"") ."%", "-1"); //colname 3
$DETAILS->bindParam("s", "%".(isset($_POST['param'])?$_POST['param']:"") ."%", "-1"); //colname 4
$DETAILS->execute();
?>

Thank you in advance for any advice on how to turn this query into a multiple word search.

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