Friday 20 September 2019

php - MySQL group duplicates together

I have a MYSQL database which looks like this:



 ID      | Name    | Product
--------+---------+----------
65644 | Charlie | Beer
65644 | John | Beer
65644 | Jan | Beer
65644 | Phoebe | Beer

65644 | Shaun | Beer


I would like to output a table using php to look something like this:



 ID      |               Name                | Product
--------+-----------------------------------+----------
65644 | Charlie, John, Jan, Phoebe, Shaun | Beer



Currently I've only been able to output it to look like this first table. Any help would be greatly appreciated.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...