I’m sure the answer to this question is an easy one (I hope).
I am loading a row from mysql into a php object. The query includes references to the group_concat MySQL function.
This returns an object with a structure that includes group_concat as one of its keys (Please excuse / correct me if I am not using the correct terminology)
When I var_dump the $row variable, it looks like this:
object(stdClass)#21 (2) { [“id”]=> string(4) “7583”
[“group_concat(resourceId)”]=> string(2) “25,26”}
I can reference the id by using: $row->id , but I can’t reference the resourceId by using $row->group_concat(resourceId)
I get the following error:
Call to undefined method stdClass::group_concat()
Please let me know how I can get hold of the data in that group_concat(resourceId) field?
Thank you.
Use an alias for your
group_concatin your select statement. Something likeThen you can reference that “column” with the alias name.