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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:14:39+00:00 2026-05-22T16:14:39+00:00

Long backstory on this, and this seems to be the simplest solution. I have

  • 0

Long backstory on this, and this seems to be the simplest solution. I have a table that will populate with user id’s from a database. I need to figure out a way to add a comma between id’s if there is more than one. The td id is username.

I’m not sure where to really start. I would need to index it and see if the html is > 1. And if so, add a comma between each word. Please help. This is a p.o.c forum and it doesn’t suit me to add/use jQuery, so I need to do it in vanilla JavaScript.

Here is the code that pulls it from the database:

if ($this->post['post_thanks_amount'] > 0 && $this->thread['isdeleted'] == 0)
{
    $this->post['post_thanks_bit'] = fetch_thanks_bit($this->thread['forumid'], $thanks);
    $this->post['post_thanks_user'] = $post_thanks_user;
    $this->post['post_thanks_amount_formatted'] = vb_number_format($this->post['post_thanks_amount']);
    $post_thanks_box = fetch_post_thanks_template($this->post);
}

And the output with one user is this:

<tr valign="top">
    <td style="background:#E8E8E8;" colspan="2" class="alt1">
        <div>
            <a rel="nofollow" href="member.php?u=20420">ninja1</a>
            <a rel="nofollow" href="member.php?u=26154">testuser</a>
        </div>
    </td>
</tr>

so after each <a...> if there is more than one, add a comma.

  • 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-22T16:14:40+00:00Added an answer on May 22, 2026 at 4:14 pm

    If ids is an array, then just use join:

    ids = [1, 2, 3, 4];
    val = ids.join(', ');
    // val is now "1, 2, 3, 4"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

long time listener first time caller... I have this function (I don;t recall where
Long story short, I have a long code that uses jQuery. Lots of files,
Long story short, I have a SQL file that I want to import as
Long story short, I have two regex patterns. One pattern matches things that I
Long ago I have created a following template so that I get an assert
Long story short, I took over a project and a table in the database
Long introduction, question is at the end: Assume I have a base class that's
Long story short Say I have the following code: // a class like this
Let's say I have a javascript method that takes a little to long to
Long story short, I have a substantial Python application that, among other things, does

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.