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