function test($name) { $this->table = LZ_MYSQL_PREFIX . 'item'; $data = parent::query("SELECT * FROM `lz_item` WHERE `name` like '" . $name . "%' ORDER BY user_id DESC;"); var_dump($data); $this->table = LZ_MYSQL_PREFIX . 'user'; return $data; }
function get_prev_next($curCid = "") { $map = "SELECT category_id FROM `lz_category` WHERE parent_id=1 AND status=1 ORDER BY category_id desc limit 1"; if (isset($curCid)) { $map = $map = "SELECT * FROM `lz_category` WHERE parent_id=1 AND category_id=" . $curCid . " AND status=1 ORDER BY category_id DESC LIMIT 1"; } $lastestId = parent::query($map); $lastestId = $lastestId[0]['category_id']; $prevId = parent::query("SELECT * FROM `lz_category` where `category_id`<" . $lastestId . " and `parent_id`=1 and `status`=1 order by `category_id` desc limit 1"); $prevId = $prevId[0]['category_id']; $nextId = parent::query("SELECT * FROM `lz_category` where `category_id`>" . $lastestId . " and `parent_id`=1 and `status`=1 order by `category_id` asc limit 1"); $nextId = $nextId[0]["category_id"]; return array("prev" => $prevId, "cur" => $lastestId, "next" => $nextId); }