lqlist.inc.php 1009 B

1234567891011121314151617181920212223
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. if (!$_GPC['type']) {
  5. $_GPC['type'] = 'all';
  6. }
  7. $where = " where a.coupons_id=:coupons_id and a.pay_type=2";
  8. $data[':coupons_id'] = $_GPC['id'];
  9. if ($_GPC['type'] == 'ok') {
  10. $where .= " and a.state=1";
  11. }
  12. if ($_GPC['type'] == 'no') {
  13. $where .= " and a.state=2";
  14. }
  15. $pageindex = max(1, intval($_GPC['page']));
  16. $pagesize = 10;
  17. $sql = "SELECT a.*,b.name as user_name,b.img as user_img FROM " . tablename('zhtc_usercoupons') . " a" . " left join " . tablename("zhtc_user") . " b on a.user_id=b.id " . $where . " ORDER BY a.id DESC";
  18. $total = pdo_fetchcolumn("SELECT count(*) FROM " . tablename('zhtc_usercoupons') . " a" . " left join " . tablename("zhtc_user") . " b on a.user_id=b.id " . $where . " ORDER BY a.id DESC", $data);
  19. $select_sql = $sql . " LIMIT " . ($pageindex - 1) * $pagesize . "," . $pagesize;
  20. $list = pdo_fetchall($select_sql, $data);
  21. $pager = pagination($total, $pageindex, $pagesize);
  22. include $this->template('web/lqlist');