How to remove a comma off the end in the last listing?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 14, 2020   (RSS)

By gord - August 14, 2020

I think the easiest way to do this is to simply populate an array and then use json_encode() to output it...

Gord

By Tom - August 14, 2020

Hello,

Thanks for your info and I've just use a stupid way to solve it.

Thanks again

"director": {
                "@type": "Person",
                "name": "abcdefg"
              }
            }
          }<?php if($listingDetails['totalRecords'] != $counter)
            { echo ",";} ?> 
		   <?php $counter++ ?>
               <?php endforeach ?>
      ]
    }
    </script>