I would like to know how to shorten text generated from the mysql database. I tried doing this by following a few tutorials I found on the internet but failed.
Here is my code,
<?php
$dbh=mysql_connect("localhost","root","root") or die ('Cannot connedt to the Database' .mysql_errno());
mysql_select_db("myinfo_db");
$res_query = mysql_query("SELECT A.cat_id as cat_id, count(A.cat_id) as cnt, B.category as category FROM listings A, category B WHERE A.cat_id=B.cat_id GROUP BY A.cat_id");
while ($category = mysql_fetch_assoc($res_query) )
{
echo '<a href="page.php?cat_id='.$category['cat_id'].'">'.$category['category'].' ('.$category['cnt'].')</a><br />';
}
?>