This should do the trick here:
require(\"databaseconnection.php\");
$tags=array();
$sql = \"SELECT tag, COUNT(tag) as count FROM links_tags GROUP BY tag ORDER BY count\";
$result = mysql_query($sql);
while ($rowInfo = mysql_fetch_assoc($result))
{
$tempTag[tag_name] = $rowInfo[\'tag\'];
$tempTag[tag_count] = $rowInfo[\'count\'];
$tags[] = $tempTag;
}
$tags = cloud_tags($tags);