简体   繁体   中英

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....

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM