Jilco Tigchelaar
Jilco Tigchelaar

Reputation: 2149

Display group_concat results in php

I use a group concat in my query that returns a single result row (Thats wy i use group concat). But how To display the results of the group concat, is there a way with an array pointer maybe? There are always 9 results in the group concat vallue....

Upvotes: 0

Views: 2987

Answers (1)

codingbiz
codingbiz

Reputation: 26386

You can use php explode function to get the concatenated values into array

$value = $row['concat_col'];
$values = explode(",", $value); //assuming you group_concat used commas e.g. John,James,Jim

//$values is an array of strings concatenated by group_concat
echo $values[0]; //John
echo $values[1]; //Jim

Upvotes: 2

Related Questions