本文整理汇总了PHP中mysql_like_quote函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_like_quote函数的具体用法?PHP mysql_like_quote怎么用?PHP mysql_like_quote使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_like_quote函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exam_prj_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function exam_prj_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['name'] = empty($_REQUEST['search_name']) ? '' : trim($_REQUEST['search_name']);
//名称
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['name'] = json_str_iconv($filter['name']);
}
$filter['sort'] = empty($_REQUEST['sort']) ? 'prj_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
$ex_where = " WHERE class_code='" . $_SESSION["class_code"] . "' ";
if ($filter['name']) {
$ex_where .= " AND name like '" . mysql_like_quote($filter['name']) . "%'";
}
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("exam_prj") . $ex_where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table("exam_prj") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
// echo $sql; echo '<br>';
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db']->getAll($sql);
$arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例2: sms_list
/**
* 返回短信列表数据
*/
function sms_list($class_code, $phone)
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['keywords'] = empty($_REQUEST['search_keyword']) ? '' : trim($_REQUEST['search_keyword']);
//关键字
$filter['phones'] = empty($_REQUEST['search_phones']) ? '' : trim($_REQUEST['search_phones']);
//学校code
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keywords'] = json_str_iconv($filter['keywords']);
}
$filter['sort'] = empty($_REQUEST['sort']) ? 'sms_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '20' : trim($_REQUEST['rows']);
$ex_where = " WHERE class_code='" . $class_code . "' and phones like '%{$phone}%'";
if ($filter['keywords']) {
$ex_where .= " AND content LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
}
$filter['record_count'] = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS["ecs"]->table("sms") . $ex_where);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT * " . " FROM " . $GLOBALS["ecs"]->table("sms") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
$filter['keywords'] = stripslashes($filter['keywords']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$sms_list = $GLOBALS['db']->getAll($sql);
$arr = array('rows' => $sms_list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例3: course_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function course_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['semster'] = empty($_REQUEST['search_semster']) ? '' : trim($_REQUEST['search_semster']);
//名称
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['semster'] = json_str_iconv($filter['semster']);
}
$ex_where = " WHERE class_code='" . $_SESSION["class_code"] . "' ";
if ($filter['semster']) {
$ex_where .= " AND semster = '" . mysql_like_quote($filter['semster']) . "'";
}
$sql = "SELECT * FROM " . $GLOBALS['ecs']->table("course") . $ex_where;
// echo $sql; echo '<br>';
$filter['semster'] = stripslashes($filter['semster']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db']->getRow($sql);
return $list;
}
示例4: get_stock_control_log
function get_stock_control_log()
{
$result = get_filter();
if ($result === false) {
$filter = array();
$filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
$filter['admin_agency_id'] = empty($_REQUEST['admin_agency_id']) ? '' : trim($_REQUEST['admin_agency_id']);
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keyword'] = json_str_iconv($filter['keyword']);
}
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'a.id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$filter['start_date'] = empty($_REQUEST['start_date']) ? local_strtotime('-30 days') : $_REQUEST['start_date'];
$filter['end_date'] = empty($_REQUEST['end_date']) ? local_strtotime('today') : $_REQUEST['end_date'];
if (strpos($filter['start_date'], '-') !== false) {
$filter['start_date'] = local_strtotime($filter['start_date']);
$filter['end_date'] = local_strtotime($filter['end_date']);
}
$where = agency_where();
/*add by hg for date 2014-04-21 可选商品*/
if (if_agency()) {
if (!empty($filter['admin_agency_id'])) {
$where .= " AND (a.admin_agency_id = {$filter['admin_agency_id']} ) ";
} else {
$where .= " AND (a.admin_agency_id = 0 ) ";
}
}
if (!empty($filter['keyword'])) {
$where .= " AND (a.goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%' or a.stock_number LIKE '%" . mysql_like_quote($filter['keyword']) . "%' )";
}
if ($filter['start_date']) {
$where = $where . " AND a.log_time >= '{$filter['start_date']}'";
}
if ($filter['end_date']) {
$where = $where . " AND a.log_time <= '" . ($filter['end_date'] + 86400) . "'";
}
$sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('stock_control_log') . ' AS a ' . 'WHERE 1 ' . $where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
/* 获取库存日志管理数据 */
$sql = 'SELECT a.* ' . 'FROM ' . $GLOBALS['ecs']->table('stock_control_log') . ' AS a ' . 'WHERE 1 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
$filter['keyword'] = stripslashes($filter['keyword']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$arr = array();
$res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
while ($rows = $GLOBALS['db']->fetchRow($res)) {
$rows['date'] = local_date($GLOBALS['_CFG']['time_format'], $rows['log_time']);
$rows['out_type_remarks'] = $GLOBALS['db']->getOne("SELECT remarks FROM " . $GLOBALS['ecs']->table('stock_out_type') . " WHERE id = '" . $rows['out_type_id'] . "' ");
$arr[] = $rows;
}
$GLOBALS['smarty']->assign('start_date', local_date('Y-m-d', $filter['start_date']));
$GLOBALS['smarty']->assign('end_date', local_date('Y-m-d', $filter['end_date']));
$filter['start_date'] = local_date('Y-m-d', $filter['start_date']);
$filter['end_date'] = local_date('Y-m-d', $filter['end_date']);
return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
示例5: get_quotation_where
function get_quotation_where($filter)
{
include_once ROOT_PATH . ADMIN_PATH_M . '/includes/lib_main.php';
$_filter = new StdClass();
$_filter->cat_id = $filter['cat_id'];
$_filter->brand_id = $filter['brand_id'];
$where = get_where_sql($_filter);
$_filter->keyword = $filter['keyword'];
$where .= isset($_filter->keyword) && trim($_filter->keyword) != '' ? " AND (g.goods_name LIKE '%" . mysql_like_quote($_filter->keyword) . "%' OR g.goods_sn LIKE '%" . mysql_like_quote($_filter->keyword) . "%' OR g.goods_id LIKE '%" . mysql_like_quote($_filter->keyword) . "%') " : '';
return $where;
}
示例6: resource_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function resource_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['resource_type'] = empty($_REQUEST['search_resource_type']) ? '' : trim($_REQUEST['search_resource_type']);
//编号
$filter['name'] = empty($_REQUEST['search_name']) ? '' : trim($_REQUEST['search_name']);
//名称
$filter['sdate'] = empty($_REQUEST['search_sdate']) ? '' : trim($_REQUEST['search_sdate']);
//起始日期
$filter['edate'] = empty($_REQUEST['search_edate']) ? '' : trim($_REQUEST['search_edate']);
//截止日期
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['name'] = json_str_iconv($filter['name']);
}
$filter['sort'] = empty($_REQUEST['sort']) ? 'resource_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
$ex_where = " WHERE d.class_code='" . $_SESSION["class_code"] . "' ";
if ($filter['resource_type']) {
$ex_where .= " AND d.type = '" . mysql_like_quote($filter['resource_type']) . "'";
}
if ($filter['name']) {
$ex_where .= " AND d.name like '" . mysql_like_quote($filter['name']) . "%'";
}
if ($filter['sdate']) {
$ex_where .= " AND d.created >='" . mysql_like_quote($filter['sdate']) . "'";
}
if ($filter['edate']) {
$ex_where .= " AND d.created <='" . mysql_like_quote($filter['edate']) . "'";
}
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("resource") . " d " . $ex_where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT d.*, s.name as resource_type " . " FROM " . $GLOBALS['ecs']->table("resource") . " d left join " . $GLOBALS['ecs']->table("resource_type") . " s on d.type=s.rtype_id " . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
// echo $sql; echo '<br>';
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db']->getAll($sql);
foreach ($list as $k => $v) {
$list[$k]['creator_name'] = get_user_name($v["creator"], 'admin');
}
$arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例7: person_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function person_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['keywords'] = empty($_REQUEST['keywords']) ? '' : trim($_REQUEST['keywords']);
//名称
$filter['tel'] = empty($_REQUEST['tel']) ? '' : trim($_REQUEST['tel']);
//电话
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keywords'] = json_str_iconv($filter['keywords']);
}
$filter['sort'] = empty($_REQUEST['sort']) ? 'person_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
$ex_where = " WHERE class_code='" . $_SESSION["class_code"] . "' ";
if ($filter['keywords']) {
$ex_where .= " AND name LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
}
if ($filter['tel']) {
$ex_where .= " AND tel = '" . mysql_like_quote($filter['tel']) . "'";
}
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("person") . $ex_where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table("person") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
// echo $sql; echo '<br>';
$filter['keywords'] = stripslashes($filter['keywords']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db']->getAll($sql);
// foreach ($list AS $key=>$val)
// {
// $list[$key]['created'] = local_date($GLOBALS['_CFG']['time_format'], $val['created']);
// }
$arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例8: auction_list
public function auction_list($offset = '0, 12')
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keyword'] = json_str_iconv($filter['keyword']);
}
$filter['is_going'] = empty($_REQUEST['is_going']) ? 0 : 1;
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'act_id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$where = "";
if (!empty($filter['keyword'])) {
$where .= " AND goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
}
if ($filter['is_going']) {
$now = gmtime();
$where .= " AND is_finished = 0 AND start_time <= '{$now}' AND end_time >= '{$now}' ";
}
/* 分页大小 */
// $filter = page_and_size($filter);
/* 查询 */
$sql = "SELECT * " . "FROM " . $this->model->pre . "goods_activity WHERE act_type = '" . GAT_AUCTION . "' {$where} " . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT {$offset}";
$filter['keyword'] = stripslashes($filter['keyword']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$res = $this->model->query($sql);
$list = array();
foreach ($res as $row) {
$ext_info = unserialize($row['ext_info']);
$arr = array_merge($row, $ext_info);
$arr['start_time'] = local_date('Y-m-d H:i', $arr['start_time']);
$arr['end_time'] = local_date('Y-m-d H:i', $arr['end_time']);
$list[] = $arr;
}
$arr = array('item' => $list, 'filter' => $filter);
return $arr;
}
示例9: msg_list
/**
*
*
* @access public
* @param
*
* @return void
*/
function msg_list($from, $table)
{
/* 过滤条件 */
$filter['keywords'] = empty($_REQUEST['search_keywords']) ? '' : trim($_REQUEST['search_keywords']);
$filter['msg_type'] = isset($_REQUEST['msg_type']) ? intval($_REQUEST['msg_type']) : -1;
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keywords'] = json_str_iconv($filter['keywords']);
}
$filter['sort'] = empty($_REQUEST['sort']) || trim($_REQUEST['sort']) == 'msg_reply' ? 'msg_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
$where = " WHERE parent_id = '0' AND msg_from='" . $from . "' and user_id='" . $_SESSION["admin_id"] . "' ";
$filter['from'] = $from;
if ($filter['keywords']) {
$where .= " AND (msg_title LIKE '%" . mysql_like_quote($filter['keywords']) . "%' ";
$where .= " OR msg_content LIKE '%" . mysql_like_quote($filter['keywords']) . "%') ";
}
if ($filter['msg_type'] != -1) {
$where .= " AND msg_type = '{$filter['msg_type']}' ";
}
$sql = "SELECT count(*) FROM " . $table . " AS f " . $where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT * " . " FROM " . $table . $where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
$msg_list = $GLOBALS['db']->getAll($sql);
foreach ($msg_list as $key => $value) {
$reply = $GLOBALS['db']->getOne("select msg_content from " . $table . " where parent_id=" . $value["msg_id"] . " limit 1");
$msg_list[$key]['msg_status'] = $reply ? 1 : 0;
$msg_list[$key]['msg_reply'] = $reply;
$msg_list[$key]['msg_time'] = local_date($GLOBALS['_CFG']['time_format'], $value['msg_time']);
$msg_list[$key]['msg_type'] = $GLOBALS['_LANG']['type'][$value['msg_type']];
}
$filter['keywords'] = stripslashes($filter['keywords']);
$arr = array('rows' => $msg_list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例10: forum_list
/**
* 返回班级管理员列表数据
*
* @access public
* @param
*
* @return void
*/
function forum_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['keyword'] = empty($_REQUEST['search_keyword']) ? '' : trim($_REQUEST['search_keyword']);
//主体
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keyword'] = json_str_iconv($filter['keyword']);
}
$filter['sort'] = empty($_REQUEST['sort']) ? 'forum_id' : trim($_REQUEST['sort']);
$filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
$filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
$filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
$ex_where = " WHERE parent_id=0 and class_code='" . $_SESSION["class_code"] . "' ";
if ($filter['keyword']) {
$ex_where .= " AND (title like '%" . mysql_like_quote($filter['keyword']) . "%'";
$ex_where .= " OR content like '%" . mysql_like_quote($filter['keyword']) . "%')";
}
$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table("forum") . $ex_where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT * " . " FROM " . $GLOBALS['ecs']->table("forum") . $ex_where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
// echo $sql; echo '<br>';
$filter['keyword'] = stripslashes($filter['keyword']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$list = $GLOBALS['db']->getAll($sql);
foreach ($list as $key => $val) {
$list[$key]['setime'] = $val['stime'] . "-" . $val['etime'];
}
$arr = array('rows' => $list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
return $arr;
}
示例11: get_order_comment_list
/**
* 获取评论列表
* @access public
* @return array
*/
function get_order_comment_list()
{
$supplier_id = $_SESSION['supplier_id'];
/* 查询条件 */
$filter['keywords'] = empty($_REQUEST['keywords']) ? 0 : trim($_REQUEST['keywords']);
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keywords'] = json_str_iconv($filter['keywords']);
}
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 's.add_time' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$where = !empty($filter['keywords']) ? " AND order_sn LIKE '%" . mysql_like_quote($filter['keywords']) . "%' " : '';
// $sql = "SELECT count(*) FROM " .$GLOBALS['ecs']->table('shop_grade'). " WHERE user_id > 0 $where";
$sql = "SELECT count(*) FROM " . $GLOBALS['ecs']->table('shop_grade') . " s" . " LEFT JOIN " . $GLOBALS['ecs']->table('order_info') . " o" . " ON o.order_id = s.order_id" . " WHERE s.send > 0 AND o.supplier_id ='{$supplier_id}' {$where}";
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
/* 分页大小 */
$filter = page_and_size($filter);
/* 获取评论数据 */
$arr = array();
// $sql = "SELECT * FROM " .$GLOBALS['ecs']->table('shop_grade'). " WHERE user_id > 0 AND send >0$where " .
// " ORDER BY $filter[sort_by] $filter[sort_order] ".
// " LIMIT ". $filter['start'] .", $filter[page_size]";
$sql = "SELECT * FROM " . $GLOBALS['ecs']->table('shop_grade') . " s " . " LEFT JOIN " . $GLOBALS['ecs']->table('order_info') . " o " . " ON o.order_id = s.order_id " . " WHERE o.supplier_id ='{$supplier_id}' AND send >0 {$where}" . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ", {$filter['page_size']}";
$res = $GLOBALS['db']->query($sql);
while ($row = $GLOBALS['db']->fetchRow($res)) {
$u_name = $row['user_name'];
$o_id = $row['order_id'];
$row['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);
$sql = "SELECT AVG(comment_rank) FROM " . $GLOBALS['ecs']->table('comment') . " c" . " LEFT JOIN " . $GLOBALS['ecs']->table('order_goods') . " o" . " ON o.goods_id = c.id_value" . " WHERE c.order_id = '{$o_id}' AND c.order_id = o.order_id";
$comment_rank = $GLOBALS['db']->getOne($sql);
$row['comment_rank'] = round($comment_rank, 1);
$row['all_avg'] = round(($row['server'] + $row['send'] + $row['shipping'] + $row['comment_rank']) / 4, 1);
$arr[] = $row;
}
$filter['keywords'] = stripslashes($filter['keywords']);
$arr = array('item' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例12: get_where_sql
/**
* 生成过滤条件:用于 get_goodslist 和 get_goods_list
* @param object $filter
* @return string
*/
function get_where_sql($filter)
{
$time = date('Y-m-d');
$where = isset($filter->is_delete) && $filter->is_delete == '1' ? ' WHERE is_delete = 1 ' : ' WHERE is_delete = 0 ';
$where .= isset($filter->real_goods) && $filter->real_goods > -1 ? ' AND is_real = ' . intval($filter->real_goods) : '';
$where .= isset($filter->cat_id) && $filter->cat_id > 0 ? ' AND ' . get_children($filter->cat_id) : '';
$where .= isset($filter->brand_id) && $filter->brand_id > 0 ? " AND brand_id = '" . $filter->brand_id . "'" : '';
$where .= isset($filter->intro_type) && $filter->intro_type != '0' ? ' AND ' . $filter->intro_type . " = '1'" : '';
$where .= isset($filter->intro_type) && $filter->intro_type == 'is_promote' ? " AND promote_start_date <= '{$time}' AND promote_end_date >= '{$time}' " : '';
$where .= isset($filter->keyword) && trim($filter->keyword) != '' ? " AND (goods_name LIKE '%" . mysql_like_quote($filter->keyword) . "%' OR goods_sn LIKE '%" . mysql_like_quote($filter->keyword) . "%' OR goods_id LIKE '%" . mysql_like_quote($filter->keyword) . "%') " : '';
$where .= isset($filter->in_ids) ? ' AND goods_id ' . db_create_in($filter->in_ids) : '';
$where .= isset($filter->exclude) ? ' AND goods_id NOT ' . db_create_in($filter->exclude) : '';
$where .= isset($filter->stock_warning) ? ' AND goods_number <= warn_number' : '';
return $where;
}
示例13: get_exchange_goodslist
function get_exchange_goodslist()
{
$result = get_filter();
if ($result === false) {
$filter = array();
$filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keyword'] = json_str_iconv($filter['keyword']);
}
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'eg.goods_id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$where = '';
if (!empty($filter['keyword'])) {
$where = " AND g.goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
}
/* 文章总数 */
$sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('exchange_goods') . ' AS eg ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = eg.goods_id ' . 'WHERE 1 ' . $where;
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
/* 获取文章数据 */
$sql = 'SELECT eg.* , g.goods_name ' . 'FROM ' . $GLOBALS['ecs']->table('exchange_goods') . ' AS eg ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = eg.goods_id ' . 'WHERE 1 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
$filter['keyword'] = stripslashes($filter['keyword']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$arr = array();
$res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
while ($rows = $GLOBALS['db']->fetchRow($res)) {
$arr[] = $rows;
}
return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
示例14: user_list
/**
* 返回用户列表数据
*
* @access public
* @param
*
* @return void
*/
function user_list()
{
$result = get_filter();
if ($result === false) {
/* 过滤条件 */
$filter['keywords'] = empty($_REQUEST['keywords']) ? '' : trim($_REQUEST['keywords']);
if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
$filter['keywords'] = json_str_iconv($filter['keywords']);
}
$filter['rank'] = empty($_REQUEST['rank']) ? 0 : intval($_REQUEST['rank']);
$filter['pay_points_gt'] = empty($_REQUEST['pay_points_gt']) ? 0 : intval($_REQUEST['pay_points_gt']);
$filter['pay_points_lt'] = empty($_REQUEST['pay_points_lt']) ? 0 : intval($_REQUEST['pay_points_lt']);
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'user_id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$ex_where = ' WHERE 1 ';
if (isset($_REQUEST['sign'])) {
if ($_REQUEST['sign'] == 1) {
$ex_where .= " AND parent_id = 0 AND is_fenxiao <> 0 AND is_fenxiao = 1";
}
if ($_REQUEST['sign'] == 2) {
$ex_where .= " AND parent_id > 0 AND is_fenxiao <> 0 AND is_fenxiao = 1";
}
if ($_REQUEST['sign'] == 3) {
$ex_where .= " AND is_fenxiao <> 1 ";
}
}
if ($filter['keywords']) {
$ex_where .= " AND user_name LIKE '%" . mysql_like_quote($filter['keywords']) . "%'";
}
if ($filter['rank']) {
$sql = "SELECT min_points, max_points, special_rank FROM " . $GLOBALS['ecs']->table('user_rank') . " WHERE rank_id = '{$filter['rank']}'";
$row = $GLOBALS['db']->getRow($sql);
if ($row['special_rank'] > 0) {
/* 特殊等级 */
$ex_where .= " AND user_rank = '{$filter['rank']}' ";
} else {
$ex_where .= " AND rank_points >= " . intval($row['min_points']) . " AND rank_points < " . intval($row['max_points']);
}
}
if ($filter['pay_points_gt']) {
$ex_where .= " AND pay_points >= '{$filter['pay_points_gt']}' ";
}
if ($filter['pay_points_lt']) {
$ex_where .= " AND pay_points < '{$filter['pay_points_lt']}' ";
}
$filter['record_count'] = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('users') . $ex_where);
/* 分页大小 */
$filter = page_and_size($filter);
$sql = "SELECT user_id, user_name, email, is_validated, validated,status,user_money, frozen_money, rank_points, pay_points, reg_time,is_fenxiao,parent_id " . " FROM " . $GLOBALS['ecs']->table('users') . $ex_where . " ORDER by " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
$filter['keywords'] = stripslashes($filter['keywords']);
set_filter($filter, $sql);
} else {
$sql = $result['sql'];
$filter = $result['filter'];
}
$user_list = $GLOBALS['db']->getAll($sql);
$count = count($user_list);
for ($i = 0; $i < $count; $i++) {
$user_list[$i]['reg_time'] = local_date($GLOBALS['_CFG']['date_format'], $user_list[$i]['reg_time']);
$user_list[$i]['upper_user_name'] = get_upper_level($user_list[$i]['parent_id']);
$one_level_user_count = get_user_count($user_list[$i]['user_id'], 1);
$two_level_user_count = get_user_count($user_list[$i]['user_id'], 2);
$three_level_user_count = get_user_count($user_list[$i]['user_id'], 3);
$user_list[$i]['one_level_user_count'] = $one_level_user_count;
$user_list[$i]['two_level_user_count'] = $two_level_user_count;
$user_list[$i]['three_level_user_count'] = $three_level_user_count;
$user_list[$i]['total_user'] = $one_level_user_count + $two_level_user_count + $three_level_user_count;
}
$arr = array('user_list' => $user_list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
示例15: generate_goods_sn
/**
* 为某商品生成唯一的货号
* @param int $goods_id 商品编号
* @return string 唯一的货号
*/
function generate_goods_sn($goods_id)
{
$goods_sn = $GLOBALS['_CFG']['sn_prefix'] . str_repeat('0', 6 - strlen($goods_id)) . $goods_id;
$sql = "SELECT goods_sn FROM " . $GLOBALS['ecs']->table('goods') . " WHERE goods_sn LIKE '" . mysql_like_quote($goods_sn) . "%' AND goods_id <> '{$goods_id}' " . " ORDER BY LENGTH(goods_sn) DESC";
$sn_list = $GLOBALS['db']->getCol($sql);
if (in_array($goods_sn, $sn_list)) {
$max = pow(10, strlen($sn_list[0]) - strlen($goods_sn) + 1) - 1;
$new_sn = $goods_sn . mt_rand(0, $max);
while (in_array($new_sn, $sn_list)) {
$new_sn = $goods_sn . mt_rand(0, $max);
}
$goods_sn = $new_sn;
}
return $goods_sn;
}