Использование:
SELECT t.catid,
GROUP_CONCAT(t.description),
GROUP_CONCAT(t.price)
FROM LINKAT_LINK t
WHERE t.emailuser = mysql_real_escape_string($email2)
OR t.linkname = mysql_real_escape_string($domain_name2)
GROUP BY t.catid
ORDER BY t.date DESC
LIMIT mysql_real_escape_string($From), mysql_real_escape_string($PageNO)
... вернет:
catid description price
--------------------------------
1 domain name,book 100,50
2 hosting,myservice 20,20
См. Документацию о том, что функция GROUP_CONCAT
делает .
Как вывести его на экран с помощью PHP?
Использование:
<?php
$query1 = "SELECT t.catid,
GROUP_CONCAT(t.description) AS grp_desc,
GROUP_CONCAT(t.price) AS grp_price
FROM LINKAT_LINK t
WHERE t.emailuser = mysql_real_escape_string($email2)
OR t.linkname = mysql_real_escape_string($domain_name2)
GROUP BY t.catid
ORDER BY t.date DESC
LIMIT mysql_real_escape_string($From), mysql_real_escape_string($PageNO)";
$result = mysql_query($query1);
while($row = mysql_fetch_array($result)) {
echo "CatID:{$row['catid']} <br>" .
"Description : {$row['grp_desc']} <br>" .
"Price : {$row['grp_price']} <br><br>";
} ?>