當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataAccess::execQuery方法代碼示例

本文整理匯總了PHP中DataAccess::execQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataAccess::execQuery方法的具體用法?PHP DataAccess::execQuery怎麽用?PHP DataAccess::execQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DataAccess的用法示例。


在下文中一共展示了DataAccess::execQuery方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: json_encode

    }
    if ($filter['operator'] != 'like') {
        $filter['operator'] = 'like';
    }
    if (strlen($filter['value']) > 0) {
        $filterStr = 'WHERE al.' . $filter['property'] . '::text ' . $filter['operator'] . ' \'%' . $filter['value'] . '%\'';
    }
}
//Запрос для подсчета общего кол-ва записей для пейджинга
$sqltext = 'SELECT count(*) FROM (
              SELECT DISTINCT al.ip, ci.client, ci.os
              FROM access_log al
              LEFT JOIN client_info ci ON ci.ip = al.ip
              ' . $filterStr . '
            ) m';
$a = $dataAccess->execQuery($sqltext, array());
$sqltext = 'SELECT DISTINCT
                al.ip,
                ci.client,
                ci.os,
                (SELECT al1.url_from FROM access_log al1 WHERE al1.ip = al.ip ORDER BY al1.access_date ASC LIMIT 1)  AS url_from,
                (SELECT al2.url_to   FROM access_log al2 WHERE al2.ip = al.ip ORDER BY al2.access_date DESC LIMIT 1) AS url_to,
                count (DISTINCT al.url_to) AS url_count
            FROM access_log al
            LEFT JOIN client_info ci ON ci.ip = al.ip -- выбираем записи независимо есть ли для них браузер
            ' . $filterStr . '
            GROUP BY al.ip, ci.client, ci.os
            ORDER BY ' . $sortStr . '
            LIMIT $1 OFFSET $2';
$records = $dataAccess->execQuery($sqltext, array($limit, $start));
echo json_encode(array('records' => $records, 'totalCount' => $a[0]['count']));
開發者ID:ElenaKovaleva,項目名稱:log_viewer,代碼行數:31,代碼來源:log_viewer.php


注:本文中的DataAccess::execQuery方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。