Tom
Member since Jun 26, 2024
- Profile: /members/14672-tom.htm
- URL: http:///
- Comments: 3
Recent Blog Comments By Tom
-
Goodbye GROUP_CONCAT(), Hello JSON_ARRAYAGG() And JSON_OBJECTAGG() In MySQL 5.7.32
Posted on Jun 26, 2024 at 7:16 PM
@Ben Nadel, Thanks! I'm not a database expert, too. But today your post gave me the occasion to learn something new: JSON_OBJECTAGG's key cannot be null, otherwise you get the error "PDOException: SQLSTATE[22032]: <>: 3158 JSON documents may not contain NULL member names". ... read more »
-
Goodbye GROUP_CONCAT(), Hello JSON_ARRAYAGG() And JSON_OBJECTAGG() In MySQL 5.7.32
Posted on Jun 26, 2024 at 2:01 PM
No, they're not the same thing. In PHP, to iterate an object, you need to convert it in an associative array, this way: $array = json_decode($object, true); foreach($array as $item) { echo $item; } What I need to know is if - using MySQL 8 - there's a way to get an associative array ... read more »
-
Goodbye GROUP_CONCAT(), Hello JSON_ARRAYAGG() And JSON_OBJECTAGG() In MySQL 5.7.32
Posted on Jun 26, 2024 at 12:36 PM
Thanks for this useful post! Just a question: is there a way to convert JSON_OBJECTAGG to an associative array using only MySQL (no PHP)? I mean something like this: from {"key-1": "val-1", "key-2": "val-2"} to ["key-1" => "va... read more »