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

  • SEARCH
  • Home
  • 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 8046173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:43:27+00:00 2026-06-05T05:43:27+00:00

I have a MySQL query as below; $query = SELECT * FROM dictionary WHERE

  • 0

I have a MySQL query as below;

$query = "SELECT * FROM dictionary WHERE word LIKE '%".$word."%' ORDER BY word LIMIT 10";

This will search for (and display) words in my dictionary db.

the search will return;

Drunken for Drunk, etc, etc.. ,
Drunken for Drunke, etc, etc..
and Drunken for Drunken, etc, etc..

But it won’t return Drunken for Drunkin. I would like to display this word as a suggestion word (like the one we see in google). How can I do this?

below is my complete code for reference;

$db = new pdo("mysql:host=localhost;dbname=dictionary", "root", "password");
$query = "SELECT * FROM dictionary WHERE word LIKE '%".$word."%' ORDER BY word LIMIT 10";
$result = $db->query($query);
$end_result = '';
if ($result) {
    while ( $r = $result->fetch(PDO::FETCH_ASSOC) ) {
        $end_result .= $r['word'].'<br>';
    }
}
echo $end_result;
  • 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-05T05:43:28+00:00Added an answer on June 5, 2026 at 5:43 am

    Try Using SOUNDEX

    Soundex keys have the property that words pronounced similarly produce
    the same soundex key, and can thus be used to simplify searches in
    databases where you know the pronunciation but not the spelling. This
    soundex function returns a string 4 characters long, starting with a
    letter.

    Here are some questions on SO which may guide you in the right direction:

    • How does the Google “Did you mean?” Algorithm work?
    • How do you implement a “Did you mean”?

    Hope this helps.

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

Sidebar

Related Questions

I have written this query for retrieving data from mysql as below select FeedbackCode,EMailID,FeedbackDetail,
I have this MySQL query SELECT count( * ) AS total FROM `orders` o,
I have a MySQL query like this: SELECT DAYNAME(CreatedAt) AS TheDay, SUM(Amount) AS TheSum
I have some problem regarding the search in mysql. Below is my query. SELECT
I have this query below: $msgg = mysql_query(SELECT * FROM mytable WHERE time>$time AND
I need to have MySQL query like this one: UPDATE table_name SET 1 =
I have this MySQL query: SELECT DISTINCT hours.project_id , projects.name , sum(hours.spent_hours) AS expr1
I have a long list generated from a simple mysql select query. Currently (shown
The sql injection will work only when my query looks like below sample SELECT
Possible Duplicate: php/Mysql query with inserting date fails I have a datepicker code below:

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.