/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$sql = "SELECT * FROM `site` WHERE `id`='1' "; $result = doSQL($sql); $sqlBG = " SELECT `bgFile` FROM `site_bgs` AS r1 JOIN (SELECT (RAND() * (SELECT MAX(bgID) FROM random)) AS id) AS r2 WHERE r1.id >= r2.id ORDER BY r1.id ASC LIMIT 1; "; $range_sql = " SELECT MAX(`bgID`) AS max_id , MIN(`bgID`) AS min_id FROM `site_bgs` " ; $range_result = doSQL($range_sql); // Special code for Jane to test backgrounds $sqlBG = " SELECT * FROM `site_bgs` WHERE `bgID`='$bg' "; } else { $sqlBG = " SELECT * FROM `site_bgs` WHERE `bgID` >= $random LIMIT 0,1 "; } $resultBG = doSQL($sqlBG); $bg = $rBG['bgFile'];