MySQL Database Php

function that would give me a random result from a mySQL table
srand(date("s"));
$result = mysql_db_query("frizbcd","SELECT cd_id FROM CD_Table",$linkid);
$rnum = rand() % mysql_numrows($result);
$sql ="SELECT cd_id,artist_title,upc FROM CD_Table WHERE cd_id = ";
$sql .= mysql_result($result,$rnum,"cd_id");
$result = mysql_db_query("frizbcd",$sql,$linkid);
echo "\"0\">";
$artisttitle = split("/",mysql_result($result,$ridx,"artist_title"));
echo "
2>
Do you have this CD by $artisttitle[0] in YOUR collection?

";
$image = "cdimages/".strtolower(mysql_result($result,0,"upc")).".gif";
if (file_exists($image)) { echo "

"; }
echo "

";
echo "";
echo "

";
echo $totalcds," CDs currently in the database";
?>