public static function byUser($id_user) { $sql = "SELECT\n\t\t\t\t\tb.*\n\t\t\t\tFROM\n\t\t\t\t\tbookings b\n\t\t\t\tWHERE\n\t\t\t\t\tb.id_user = ?"; return Model::fetchAll($sql, __CLASS__, $id_user); }
public function getAttributes() { $sql = "SELECT * FROM tice_attributes"; return parent::fetchAll($sql); }
public static function all() { $sql = "SELECT\n\t\t\t\t\tu.*\n\t\t\t\tFROM\n\t\t\t\t\tusers u\n\t\t\t\tORDER BY u.id ASC"; return Model::fetchAll($sql, __CLASS__); }
public function getTables() { $sql = "select `TABLE_NAME` AS tableName from `INFORMATION_SCHEMA`.`TABLES`\n where `TABLE_SCHEMA` = 'tice' and `TABLE_NAME` LIKE 'tice_data%' ORDER BY tableName DESC "; return parent::fetchAll($sql); }
public static function all() { $sql = "SELECT\n\t\t\t\t\tr.*,\n\t\t\t\t\tl.*\n\t\t\t\tFROM\n\t\t\t\t\trooms r, rooms_lang l\n\t\t\t\tWHERE\n\t\t\t\t\tr.id = l.id AND l.id_lang = " . ID_LANG . "\n\t\t\t\tORDER BY r.id ASC"; return Model::fetchAll($sql, __CLASS__); }
<?php $model = new Model(); $cateID = ''; if (isset($this->arrayParams['book_id'])) { $bookID = $this->arrayParams['book_id']; $queryCate = "SELECT `category_id` FROM `" . TBL_BOOK . "` WHERE id = '{$bookID}'"; $resultCate = $model->fetchRow($queryCate); $cateID = $resultCate['category_id']; } else { if (isset($this->arrayParams['category_id'])) { $cateID = $this->arrayParams['category_id']; } } $query = "SELECT `id`, `name` FROM `" . TBL_CATEGORY . "` WHERE `status` = 1 ORDER BY `ordering` ASC"; $listCats = $model->fetchAll($query); echo $cateID; $xhtml = ''; if (!empty($listCats)) { foreach ($listCats as $key => $value) { $link = URL::createLink('default', 'book', 'list', array('category_id' => $value['id'])); $name = $value['name']; if ($cateID == $value['id']) { $xhtml .= '<li><a class="active" title="' . $name . '" href="' . $link . '">' . $name . '</a></li>'; } else { $xhtml .= '<li><a title="' . $name . '" href="' . $link . '">' . $name . '</a></li>'; } } } ?> <div class="right_box">
public static function byIdRoom($id_room) { $sql = "SELECT\n\t\t\t\t\tr.*\n\t\t\t\tFROM\n\t\t\t\t\tphysicalrooms r\n\t\t\t\tWHERE\n\t\t\t\t\tr.id_room = ?"; return Model::fetchAll($sql, __CLASS__, $id_room); }
$result = $mysqli->query($command); if ($result) { print "Query OK, " . $mysqli->affected_rows . " rows affected"; } else { print "Error: " . $mysqli->error; } } catch (Exception $e) { printColor($e->getMessage(), "red"); } } else { if (preg_match('/^select|show|describe/i', $command)) { try { reuse($command); if (preg_match('/\\\\G$/', $command)) { $command = preg_replace('/\\\\G$/', '', $command); $result = $mysqli->fetchAll($command); printQueryResultBlock($result); } else { $result = $mysqli->fetchAll($command); printQueryResult($result); } } catch (Exception $e) { printColor($e->getMessage(), "red"); } } else { die("{$command}: command not found"); } } } } }
public static function all() { $sql = "SELECT\n l.*\n FROM\n languages l\n ORDER BY l.id ASC"; return Model::fetchAll($sql, __CLASS__); }