Hello I have setup a GROUP_CONCAT within my loop that outputs data from multiple rows into one string. How would I link each row data separately?
echo '<a href="link">' . $row['like_user'] . '</a>';
The above outputs this:
<a href="link">1,2,3</a>
BUT, I want it to output this:
<a href="link">1</a>
<a href="link">2</a>
<a href="link">3</a>
[/QUOTE]
Hi. This does not work. It still adds a href to the entire string instead of individually.
Removing group_concat is not an option for me.
Assuming that the result set has one entry per row, in a loop use.
echo "<a href='link'>{$row['like_user']}</a>";
If it’s not one entry per row, try removing the group_concat
r937
4
spacephoenix, you have to realize that jaynesh has a habit of starting new threads when his problem morphs
this previous thread should give you the required background…
I created a new thread in the PHP area, because that is where I feel it belongs. I don’t see why that is wrong…
r937
6
it wasn’t wrong, provided that you supply sufficient background information for people responding to the new thread
however, it would’ve been so much easier to ask a moderator to move the previous thread to the php forum, right?
oddz
7
foreach( explode(',',$row['like_user']) as $id) {
echo "<a href=\\"$id\\">$id</a>";
}