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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:11:07+00:00 2026-06-08T17:11:07+00:00

I want to convert a text and comma separated text to link and class,

  • 0

I want to convert a text and comma separated text to link and class, Like:

facebook.com,facebook
twitter.com,twitter
youtube.com,youtube

text before comma will be link and text after comma will be link class attribute, like

$link = text before comma
$class= text after comma
<a href="$link" class="$class">$class</a>

and get all list using loop.
please don’t put half code, treat me as beginner and help me,
thanks

  • 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-08T17:11:10+00:00Added an answer on June 8, 2026 at 5:11 pm

    Seems like you’re trying to pull from a database. I’m gonna go out on a limb here and say you’re just using the basic mysql_* functions.

    $sql = "SELECT columnName from `tableName`";
    $res = mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_assoc($res);
    
    foreach(explode(PHP_EOL, $row['columnName']) AS $line){
        // PHP_EOL is a line ending for that system, if you are positive that the column
        // is separated by \n, or \r\n then replace that instead of PHP_EOL
        list($link, $lcass) = explode(',', $line);
    
        echo '<a href="'.$link.'" class="'.$class.'">'.$class.'</a><br />';
    }
    

    I think $lcass will be $class

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

Sidebar

Related Questions

I want to convert my text into HTML format, it would be just like
I want to convert a link to a definite text by using regular expression.While
i want to build an application on Android platform that will convert text to
Possible Duplicates: PHP Regex to convert text before colon to link Return the portion
I have some html files that I want to convert to text. I have
I want to convert a string to formatted text in C# in WPF application,
I have a TextBoxD1.Text and I want to convert it to an int to
I want to use the Discount C-library to convert Markdown text into HTML. I
I have a text document (.txt). I want to convert it to an image
I want to convert plaintext to link for an input I have. The HTML

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.