postscriptDao.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. // 매물정보 DAO
  3. include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
  4. $cdDealerP= trim(avoid_crack($_REQUEST["cdDealerP"]));
  5. $PageNo = trim(avoid_crack($_REQUEST["PageNo"]));
  6. $PageSize = trim(avoid_crack($_REQUEST["PageSize"]));
  7. $pageStartPoint = trim(avoid_crack($_REQUEST["pageStartPoint"]));
  8. $defaultWhere =" where s.ds_delind='N' ";
  9. switch($mode) {
  10. //매물리스트
  11. case "listNormal" :
  12. $where_is ="";
  13. $where_is = $where_is. " and s.ds_status in ('ZS') ";
  14. $where_is = $where_is. " and s.nm_cont_postscript != '' ";
  15. $where_is = $where_is. " and s.cd_sale in (select cd_sale from tender_master where cd_dealer_p = '$cdDealerP') ";
  16. $totalCount = @mysql_result(mysql_query("select count(*) from sale_master
  17. $defaultWhere $where_is "),0,0);
  18. $sql = " SELECT
  19. s.*
  20. , (select (select nm_model from car_model where cd_model = c.cd_model) from car_master c where c.cd_car = s.cd_car) as nm_model
  21. FROM sale_master s
  22. $defaultWhere $where_is order by s.cd_sale desc LIMIT $pageStartPoint,$PageSize";
  23. $r = mysql_query($sql);
  24. $jsonArray = array();
  25. while($row = mysql_fetch_array($r)) {
  26. $row[totalCnt] = $totalCount;
  27. array_push($jsonArray,$row);
  28. }
  29. echo json_encode($jsonArray);
  30. break;
  31. default :
  32. echo "999";
  33. break;
  34. }
  35. $dbCon->close();
  36. die();
  37. ?>