本文整理汇总了PHP中f::dbEscape方法的典型用法代码示例。如果您正苦于以下问题:PHP f::dbEscape方法的具体用法?PHP f::dbEscape怎么用?PHP f::dbEscape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类f
的用法示例。
在下文中一共展示了f::dbEscape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: step2
private static function step2($page, $start, $rowsPerPage, $outData)
{
$excel = f::getParam("excel") == 1;
$order = f::getParam("order") * 1;
$orderDesc = f::getParam("orderDesc") * 1;
$orderBy = $order == "" ? "" : " ORDER BY {$order}";
$clientId = f::dbRes("select client_id from fm_forms where id = {p:form_id}");
$siteTableId = "fm_userdata_" . substr("00" . $clientId, -3);
$limit = $excel ? "" : " limit {$start}, {$rowsPerPage}";
$textFilter = "";
if (f::getParam("textFilter")) {
$textFilter = " and user_data like '%" . f::dbEscape(f::getParam("textFilter")) . "%'";
}
$sql = "select SQL_CALC_FOUND_ROWS id, date_format(created_date,'%d/%m/%Y %H:%i') as created_date, user_data \n\t\t\t\t\t\tfrom {d:siteTableId}\n\t\t\t\t\t\twhere form_id = {p:form_id} \n\t\t\t\t\t\t{n:textFilter}\n\t\t\t\t\t\torder by id desc {d:orderBy} {d:limit}";
$formData = f::dbFullRes($sql, array("siteTableId" => $siteTableId, "textFilter" => $textFilter, "orderBy" => $orderBy, "limit" => $limit));
foreach ($formData as $k => $v) {
$formData[$k]["user_data"] = json_decode($formData[$k]["user_data"], true);
}
$totalRows = f::dbRes("SELECT FOUND_ROWS()");
if ($totalRows <= $page * $rowsPerPage) {
$outData["nextPage"] = 0;
}
$form = f::dbFirstRow("select id, name, enabled_domains, detail \n\t\t\t\tfrom fm_forms \n\t\t\t\twhere id = {p:form_id}");
$form["detail"] = json_decode($form["detail"], true);
$outData["form"] = $form;
$outData["data"] = $formData;
$outData["totalRows"] = $totalRows;
$outData["order"] = $order;
$outData["orderDesc"] = $orderDesc;
$outData["end"] = min($outData["start"] + $rowsPerPage, $totalRows);
if (!$excel) {
f::setResponseJson($outData);
} else {
$out = self::prepareExcel($form, $formData);
$formName = preg_replace("/[^A-Za-z0-9 ]/", '', $form["name"]);
f::setExcelOutput($form["id"] . "_{$formName}_" . date("Ymd_His") . ".xls", $out);
}
}