Skip to content
Advertisement

Echo Array Values in Comma Separated List

I am selecting values from my database, when I dump the $results I get;

JavaScript

I want to display the following on my page;

Certification List: White Belt, Yellow Belt

I have created a loop but when I echo the result I get this;

JavaScript

My PHP code;

JavaScript

What do I need to change in order to get this working?

Advertisement

Answer

You shouldn’t push arrays into $items, just push the values.

JavaScript

You can also replace the loop with:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement