I am group_concat a bunch of reviews from my db which turns it into something like this:
This is review 1, This is review 2
then I explode it into an array like:
$review = $row->review;
$row->review = explode(',', $review);
This works great until someone in there review adds a ,
then it obsoulvy no longer works. So is there a way to group_concat and put something besides a comma between them? Is there a better way of fixing this? Any ideas would be greatly appreciated.
Yes, don't use GROUP_CONCAT
. Create a subtable containing the reviews and appropriate relationships that link each review to.. whatever entities you are dealing with.
If you already have it set up like this, and are just using GROUP_CONCAT
to fetch multiple reviews into a single result set... then still don't use GROUP_CONCAT
. Use a subquery.
GROUP_CONCAT
and friends): http://www.amazon.com/Beginning-MySQL-Database-Design-Optimization/dp/1590593324/ref=sr11?ie=UTF8&qid=1333583845&sr=8- - Chris Laplante 2012-04-04 23:57