Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8527067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:27:04+00:00 2026-06-11T08:27:04+00:00

Possible Duplicate: How do I create a PDO parameterized query with a LIKE statement

  • 0

Possible Duplicate:
How do I create a PDO parameterized query with a LIKE statement in PHP?

At the moment I have a very simple search engine which uses the old mysql_* queries and also uses “like” in the query, i understand this is now outdated and using like queries can get slow as the database grows?

I am looking for some ideas on how I can create a search engine using PDO as it offers more protection than i currently have, I have researched about using MATCH and AGAINST in a query,to search the “title” and “description” columns in my database, but as i am a beginner i am unsure of where to start.

I get stuck on trying to figure out how to implement a search query, and getting the search to work if the user enters multiple keywords

any help is much appreciated, i understand this might be a big ask of someone to explain this to me but i am doing as much as i can to learn as i am a student and working on a project

Thankyou for anyones help!

THIS IS PART OF MY CURRENT CODE WHICH I WOULD LIKE TO CHANGE AND UPDATE TO SOMETHING MORE SECURE AND WITH BETTER SEARCH FACILITIES:

$query = "SELECT * FROM people WHERE ";

foreach ($terms as $each){
$i++;

if ($i == 1)
    $query .= "lname LIKE '%$each%' ";
if($i == 1 && $_GET['category'] != '') {
    $query .= "AND category = '$chosencategory' ";
}
else
    $query .= "AND lname LIKE '%$each%' ";
if($_GET['price'] != '') {
    $query .= " ORDER BY price $price";
}
echo $query;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:27:06+00:00Added an answer on June 11, 2026 at 8:27 am

    Now that’s a very complicated topic. So I’m just going to point you to a few starting points. If someone else is able to formulate a good answer to this hugely complicated topic here, I’d be glad to give them an upvote..

    • Doctrine 1 has a decent “search engine”. [1] (If you’re not already using an ORM, I highly recommend you give it a try.)
    • Lucene[2] is also worth a try.
    • Roll your own search engine. I also used to think it’s about some MySQL features or something, but it’s really not. It’s all about building good indexes and using them well. (Building them yourself, that is. Not just using database indexes.) It’s actually a pretty interesting topic to get into, if you have the time.
    • Buy Nine Algorithms That Changed the Future by John MacCormick.[3] It’s got an awesome chapter about how search engines work.

    [1] http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/searching.html

    [2] http://en.wikipedia.org/wiki/Lucene

    [3] http://www.amazon.com/Nine-Algorithms-That-Changed-Future/dp/0691147140

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How do I create a PDO parameterized query with a LIKE statement
Possible Duplicate: PHP : Create array for JSON I have an array like this
Possible Duplicate: How to create comma separated list from array in PHP? I have
Possible Duplicate: Create event handler for OnScroll for web browser control I would like
Possible Duplicate: Create an Array of the Last 30 Days Using PHP I am
Possible Duplicate: Create an alert on any view controller after Facebook request:didFailWithError: I have
Possible Duplicate: PHP create a file without fopen I want to create a file
Possible Duplicate: How to create a static (non-refreshing) menu bar like Facebook? How Facebook
Possible Duplicate: How to create comma separated list from array in PHP? My array
Possible Duplicate: PHP PDO vs normal mysql_connect So in my application, I accessed the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.