I want to get some data via php from my SQL database:
GROUP_CONCAT(DISTINCT cat.name SEPARATOR ",") AS cats
this gives me a list:
sam, john, joe
I get some other data like this:
GROUP_CONCAT(DISTINCT cat.id SEPARATOR ",") AS cat_ids
here I get the result
1,2,3
Now here is my problem. I want to combine these values to get a result like this:
<a href="1">sam</a><a href="2">john</a><a href="3">joe</a>
My approach:
GROUP_CONCAT(CONCAT("<a href=\'",cat.id,"\'>",cat.name,"</a>")) AS cats
But here I only get a blank white page as a result.