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 403185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:11:37+00:00 2026-05-12T17:11:37+00:00

I have a database table full of words. What I would like to do

  • 0

I have a database table full of words. What I would like to do is to have a way to show the user in the html in the form of a hyperlink, any of these keywords. Kind of like you see on many forums now a days. When a keyword is noted in the html, it becomes clickable. Is there a way to do this? I’m using php.

Thanks

  • 1 1 Answer
  • 1 View
  • 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-05-12T17:11:37+00:00Added an answer on May 12, 2026 at 5:11 pm

    The most obvious way I can think of doing this is looping through every keyword from your database, and running a preg_replace on your HTML for each (just replace each word with an appropriate hyperlink).

    Your regular expression is likely to be complex, because you will need to make sure that none of the word replacements interfere with your HTML, and you will also want to make sure you only replace whole words and not partial words.

    Lastly, if your word database is very large, this will be expensive to do on every request. So consider performing it once and storing the result.

    Alternatively, offload the processing to the client and do the replacement with JavaScript. Modifying HTML tags may not be a problem then, because you should be able to run the replace on only the text nodes of the DOM. But again, if your database is large, you will have to send a long list of words to the client for the JavaScript to loop through.

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

Sidebar

Related Questions

I have a database table full of time points and experimental values at those
I have a database table which is full-text indexed and i use the CONTAINS-function
i have database table like this +-------+--------------+----------+ | id | ip | date |
that my problem: I have database table like that: id (AI) market_id 1 6
I have a database table named Categories . I want to create a form
I have a drupal database where the node table is full of profiles. The
I have a table that looks like this: Timestamp Event User ================ ===== =====
I have a database table with some rows that I want to fetch using
I have a database table containing dates (`date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00').
I have a database table, my goal is to read in each of 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.