Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getRandomImage()
- {
- global $use_listing_approval;
- $limit = 3;
- $approved = '';
- if ($use_listing_approval) {
- if (!isset($_SESSION["admin"])) {
- if (isset($_SESSION["seller"])) {
- $approved = "";
- } else {
- $approved = "listings.approved = 1 AND listimages.approved = 1 AND ";
- }
- }
- }
- //$sql = "SELECT * FROM listimages, listings WHERE $approved listings.id = listimages.listingid AND listings.sold !=1 AND listimages.mainimage = 1 ORDER BY RAND() LIMIT $limit";
- $sql = "SELECT * FROM listimages, listings WHERE $approved listings.id = listimages.listingid AND listings.sold !=1 AND listimages.mainimage = 1 ORDER BY added_on DESC LIMIT $limit";
- $res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());
- $c=0;
- while ($a_row = sqlFetchArray($res)) {
- $records[$c]["ad_title"] = $a_row["ad_title"];
- $records[$c]["make"] = $a_row["make"];
- $records[$c]["model"] = $a_row["model"];
- $records[$c]["listingid"] = $a_row["listingid"];
- $records[$c]["imagepath"] = $a_row["imagepath"];
- $records[$c]["imagethumbpath"] = $a_row["imagethumbpath"];
- //Price_eingef�gt_09_02_09
- $records[$c]["price"] = $a_row["price"];
- ++$c;
- }
- if (isset($records))
- return $records;
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement