Text Formatted Code
function phpblock_randomLink()
{
global $_TABLES;
$retval = '';
$result = DB_query ("SELECT lid,category,url,title,description FROM {$_TABLES['links']} WHERE (hits > 0)" . COM_getPermSQL ('AND') . " ORDER BY RAND() LIMIT 1");
$nrows = DB_numRows ($result);
if ($nrows > 0) {
$A = DB_fetchArray ($result);
$url = COM_buildUrl ($_CONF['site_url']
. '/portal.php?what=link&item=' . $A['lid']);
$retval .= '<p>Category: ' . stripslashes($A['category']) . '</p>' . LB;
$retval .= '<p><a href="' . $url . '" title="' . $A['url'] . '">'
. stripslashes($A['title']) . '</a></p>' . LB;
$retval .= '<p>' . stripslashes($A['description']) . '</p>' . LB;
}
return $retval;
}