本文整理匯總了PHP中DataBase::format_text_sql方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataBase::format_text_sql方法的具體用法?PHP DataBase::format_text_sql怎麽用?PHP DataBase::format_text_sql使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DataBase
的用法示例。
在下文中一共展示了DataBase::format_text_sql方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_items
public function get_items($id, $status = '')
{
if (func_num_args() < 1) {
throw new ExceptionToDoList('Error get item : missing id');
}
if (empty($id)) {
throw new ExceptionToDoList('Error get items : missing id of todolist');
}
$id = intval($id);
$status != '' ? $filters = " AND status='" . DataBase::format_text_sql($status) . "' " : ($filters = '');
$data = json_decode(json_encode(self::generate_listItem_fromDB($id, $filters)));
return array(200, responseMessage::MESSAGE_GETITEM_SUCCESS, $data);
}
示例2: generate_listItem_fromDB
private function generate_listItem_fromDB($nameList, $filters = '')
{
// Request for this nameList in DB
$listArr = $this->DB->query_select("SELECT lists.id FROM lists WHERE name='" . DataBase::format_text_sql($nameList) . "' order by id DESC limit 0,1");
if ($listArr[0]['count_row'] == 0) {
throw new ExceptionToDoList('Error : name list not found');
}
$id = $listArr[0]['id'];
$lstTodo = parent::create($nameList);
// Create a new object of listTodo class
// Request for items nameList in DB
if (is_array($filters)) {
$filters = DataBase::generate_filter_sql($filters);
}
$listArr = $this->DB->query_select("SELECT items.content, items.status FROM items WHERE list_id={$id} {$filters} order by id DESC");
for ($i = 0; $i < $listArr[0]['count_row']; $i++) {
if ($listArr[$i]['content'] != '') {
$lstTodo->addItem(array('content' => $listArr[$i]['content'], 'status' => $listArr[$i]['status']));
}
}
return array($id, $lstTodo);
}