本文整理汇总了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']));