Advertisement
Guest User

Functions php file

a guest
Sep 29th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. function getRandomImage()
  2. {
  3. global $use_listing_approval;
  4. $limit = 3;
  5. $approved = '';
  6.  
  7. if ($use_listing_approval) {
  8. if (!isset($_SESSION["admin"])) {
  9. if (isset($_SESSION["seller"])) {
  10. $approved = "";
  11. } else {
  12. $approved = "listings.approved = 1 AND listimages.approved = 1 AND ";
  13. }
  14. }
  15. }
  16.  
  17. //$sql = "SELECT * FROM listimages, listings WHERE $approved listings.id = listimages.listingid AND listings.sold !=1 AND listimages.mainimage = 1 ORDER BY RAND() LIMIT $limit";
  18. $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";
  19. $res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());
  20.  
  21. $c=0;
  22. while ($a_row = sqlFetchArray($res)) {
  23. $records[$c]["ad_title"] = $a_row["ad_title"];
  24. $records[$c]["make"] = $a_row["make"];
  25. $records[$c]["model"] = $a_row["model"];
  26. $records[$c]["listingid"] = $a_row["listingid"];
  27. $records[$c]["imagepath"] = $a_row["imagepath"];
  28. $records[$c]["imagethumbpath"] = $a_row["imagethumbpath"];
  29. //Price_eingef�gt_09_02_09
  30. $records[$c]["price"] = $a_row["price"];
  31. ++$c;
  32. }
  33. if (isset($records))
  34. return $records;
  35. return false;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement