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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:17:11+00:00 2026-05-23T23:17:11+00:00

Hi I have tags in my database in a row called tags. They are

  • 0

Hi I have tags in my database in a row called tags. They are separated by commas.

For example, they are stored in the database as tag1,tag2,tag3.

I want to retrieve them from the database and display them one by one separately and before displaying each tag, I want to link it to a URL.

Here’s what I am doing so far,

$keywords = strip_tags($blog_query_results['keywords']); //Retrives the tags from the database

echo wordwrap(stripslashes($keywords), 65, "<br>",true); // this prints tag1,tag2, and so on.

While printing them I want to link tag1, tag2, and tag3 to different URLS.

  • 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-05-23T23:17:13+00:00Added an answer on May 23, 2026 at 11:17 pm

    If you have a string like this :

    $tags = 'tag1,tag2,tag3';
    

    You can use the explode() function to get an array of tags :

    $arr = explode(',', $tags);
    

    And, then, just iterate over that array, to build a link for each item — typically, using foreach() :

    foreach ($arr as $t) {
        echo '<a href="...">' . htmlspecialchars($t, ENT_COMPAT, 'UTF-8') . '</a><br />';
    }
    

    As a sidenote : your database’s design is probably a bit wrong, if you store more than one information in a single field.

    If you have 3 tags for a post, you should have 3 rows (one per tag), either :

    • In the tags table,
    • Or in a join-table between your posts and tags tables.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Have a old database to maintain .... they have stored html tags in
I have a database with tags for an image gallery. They contain the fields
i have a database of links and tags. what is the easiest way i
i have a database table of website links. i have another table of tags,
I have a MySQL database with 3 tables: articles, tags, and articles_tags The schema
I have strings that use simple_format so they always have p tags surrounding them.
I have a large database (~2700 entries) of vocabulary. Each row contains an English
I have a simple sql query adding a new row to a database and
I have a database full of recipes, one recipe per row. I need to
I have a table called articles and I would like to retrieve all articles

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.