Title: Hide last comma
Last modified: November 25, 2021

---

# Hide last comma

 *  [berki](https://wordpress.org/support/users/berki/)
 * (@berki)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hide-last-comma/)
 * Hi!
    The result of the following script part is: Participant 1, Participant 2,…,
   Participant n, Can you help me to hide last comma? Thanks in advance.
 * while ( $this->have_records() ) : $this->the_record(); // each record is one 
   row
    while( $this->have_fields() ) : $this->the_field(); // each field is one
   cell
 *  echo $this->field->print_value() . ‘, ‘;
 *  endwhile; // each field
    endwhile; // each record

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hide-last-comma/#post-15104300)
 * The trick I use for this is to place the list into an array, then “implode” the
   array with the commas.
 *     ```
       $display = array();
       while ( $this->have_records() ) : $this->the_record(); // each record is one row
       while( $this->have_fields() ) : $this->the_field(); // each field is one cell
   
       $display[] = $this->field->print_value();
   
       endwhile; // each field
       endwhile; // each record
   
       echo implode( ', ', $display );
       ```
   
    -  This reply was modified 4 years, 5 months ago by [xnau webdesign](https://wordpress.org/support/users/xnau/).
 *  Thread Starter [berki](https://wordpress.org/support/users/berki/)
 * (@berki)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hide-last-comma/#post-15105980)
 * Thank you for these. Interestingly, the result is exactly the opposite:
 * Participant 1 Participant 2 Participant n,

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Hide last comma’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [berki](https://wordpress.org/support/users/berki/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/hide-last-comma/#post-15105980)
 * Status: not resolved