本文整理汇总了PHP中Db::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::select方法的具体用法?PHP Db::select怎么用?PHP Db::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUsers
public function getUsers($restId)
{
$db = new Db();
$table = "rest" . $restId . "_users";
$checkRest = restExists($table);
if ($checkRest != true) {
return $checkRest;
}
$local_query = "SELECT * FROM `{$table}`";
$result = $db->select($local_query);
$userCount = count($result);
$configurationTable = "rest" . $restId . "_userConfigurations";
$configurationMappingTable = "rest" . $restId . "_userConfigurationMapping";
$userTable = "rest" . $restId . "_users";
$local_query = "SELECT M.`userID`,M.`configurationID`, C.`configurationName`,C.`configurationDisplayText`, C.`configurationType`, \n\t\tC.`configurationTag`, C.`configurationValueBinary`, C.`configurationValueText`, C.`configurationValueDecimal`, C.`comments`,M.`isAllowed` FROM \n\t\t`{$configurationMappingTable}` AS M INNER JOIN `{$configurationTable}` AS C ON `M`.`configurationID` = `C`.`configurationID` \n\t\tORDER BY M.`userID`, M.`configurationID`";
$resultConfiguration = $db->select($local_query);
$configurationCount = count($resultConfiguration);
for ($i = 0; $i < $userCount; $i++) {
$result[$i]['Permissions'] = array();
for ($j = 0; $j < $configurationCount; $j++) {
if ($result[$i]['ID'] == $resultConfiguration[$j]['userID']) {
array_push($result[$i]['Permissions'], $resultConfiguration[$j]);
}
}
}
for ($i = 0; $i < $userCount; $i++) {
for ($j = 0; $j <= count($result[$i]['Permissions']); $j++) {
unset($result[$i]['Permissions'][$j]['userID']);
}
}
$response = array();
$response["Users"] = $result;
return $response;
}
示例2: games
/**
* Example of an Endpoint
*/
protected function games($_args)
{
// var_dump($this->method);
// var_dump($this->endpoint);
// var_dump($this->verb);
// var_dump($this->args);
// var_dump($this->file);
// var_dump($this->request);
$db = new Db();
if ($this->method == 'GET') {
// /games/id
if (count($this->args)) {
return $this->_response($db->select($this->endpoint, $this->args[0]));
// /games/search?name=value
} elseif ($this->verb === "search") {
return $this->_response($db->search($this->endpoint, $this->request));
// /games/
} else {
return $this->_response($db->select($this->endpoint));
}
// /games/?name=value1&description=value2
} elseif ($this->method == 'POST') {
return $this->_response($db->insert($this->endpoint, $this->request));
} elseif ($this->method == 'PUT') {
return $this->_response("UPDATE method not found", 404);
} elseif ($this->method == 'DELETE') {
return $this->_response("DELETE method not found", 404);
} else {
return $this->_response("Request error ", 500);
}
}
示例3: getDiscountInfo
public function getDiscountInfo($restId)
{
$table = "rest" . $restId . "_discountMaster";
$checkRest = restExists($table);
if ($checkRest != true) {
return $checkRest;
}
$discountVoucherTable = "rest" . $restId . "_discountVoucher";
$discountSlotsTable = "rest" . $restId . "_discountSlots";
$db = new Db();
$local_query = "SELECT * FROM `{$table}`";
$result = $db->select($local_query);
foreach ($result as $key => $value) {
if ($value["isVoucherEnabled"]) {
$temp = $value["discountID"];
$voucher_query = "SELECT `ID`, `voucherCode`, `validFromUTC`,\n \t\t\t `validFromLocal`, `validToUTC`, `validToLocal`, `timeZone`, `isUsed`,\n \t\t\t `orderIDUsedOn`, `customerID` FROM `{$discountVoucherTable}` WHERE discountID = '{$temp}'";
$voucher = $db->select($voucher_query);
$result[$key]["Voucher Details"] = $voucher;
}
}
foreach ($result as $key => $value) {
if ($value["isSlotted"]) {
$temp = $value["discountID"];
$slot_query = "SELECT * FROM `{$discountSlotsTable}` WHERE discountID = '{$temp}'";
$slot = $db->select($voucher_query);
$result[$key]["Slot Details"] = $slot;
}
}
return $result;
}
示例4: init
function init($module, $lang, $language, $idURL, $categorie, $sscategorie, $type, $sort, $order, $page, $settings, $search)
{
$getColumn = Db::select(TABLE_PREFIX . CATEGORIE_NOM, "0");
$output = "";
$output = TemplateAdd::debutadd($module, $lang, $language, $categorie, $sscategorie, $sort, $order, $page, $search);
for ($i = 0; $i < Db::num_fields($getColumn); $i++) {
// Boucle sur les colonnes
$column = Db::fetch_field($getColumn);
$column = $column->name;
$add = "";
$column = Utils::findColumn($column, $language);
$field = Utils::findField($column);
// Trouve le type de donne et affiche le input adequat
if ($field == "id" && $settings['blanc']['showId'] == true || $field != "id") {
if (@(!(include_once 'fields/' . $field . '.field.php'))) {
// Regarde si le champ est predefini. Si pas, on utilise le champ txt par defaut
$field = "txt";
} else {
if (class_exists($field)) {
$add = stripslashes(htmlentities($add, ENT_QUOTES, "iso-8859-1"));
$getValue = new $field($lang, $add, $column, "", $categorie, $sscategorie, "add", $sort, $page, $settings);
$add = $getValue->add;
if ($this->exclusion($sscategorie, $column)) {
$output .= TemplateAdd::add($add);
}
}
}
}
}
$output .= TemplateAdd::finadd($module, $lang);
return $output;
}
示例5: getFavoritesList
/**
* 收藏列表
*
* @param array $condition 检索条件
* @param obj $obj_page 分页对象
* @return array 数组类型的返回结果
*/
public function getFavoritesList($condition, $page = '')
{
$condition_str = $this->_condition($condition);
$param = array('table' => 'flea_favorites', 'where' => $condition_str, 'order' => $condition['order'] ? $condition['order'] : 'fav_time desc');
$result = Db::select($param, $page);
return $result;
}
示例6: getList
public static function getList($query = '', $vars = array())
{
if (empty($query)) {
$query = 'SELECT * FROM ' . self::getDbTable();
}
return self::_getList(Db::select($query, $vars));
}
示例7: backupInit
public function backupInit($config)
{
F('_backup_', '[del]');
//创建目录
if (!is_dir($config['dir']) && !mkdir($config['dir'], 0755, true)) {
View::error('目录创建失败', $config['url']);
}
$table = Db::getAllTableInfo();
$table = $table['table'];
foreach ($table as $d) {
//limit起始数
$table[$d['tablename']]['first'] = 0;
//文件编号
$table[$d['tablename']]['fileId'] = 1;
}
$cache['table'] = $table;
$cache['config'] = $config;
//备份表结构
$tables = Db::getAllTableInfo();
$sql = "<?php if(!defined('HDPHP_PATH'))EXIT;\n";
foreach ($tables['table'] as $table => $data) {
$createSql = Db::select("SHOW CREATE TABLE {$table}");
$sql .= "Db::execute(\"DROP TABLE IF EXISTS {$table}\");\n";
$sql .= "Db::execute(\"{$createSql[0]['Create Table']}\");\n";
}
if (file_put_contents($config['dir'] . '/structure.php', $sql)) {
file_put_contents($config['dir'] . '/config.php', "<?php return " . var_export($config, true) . ";");
F('_backup_', $cache);
return true;
} else {
F('_backup_' . '[del]');
$this->error = '表结构备份失败';
return false;
}
}
示例8: getshou
public function getshou($condition, $page = '')
{
$condition_str = $this->_condition($condition);
$param = array('table' => 'taolun', 'where' => $condition_str, 'order' => $condition['order'] ? $condition['order'] : 'add_time desc');
$result = Db::select($param, $page);
return $result;
}
示例9: Retrive
public function Retrive($cin)
{
$bdd = new Db();
$query = "SELECT * FROM card WHERE cin=" . $cin;
$result = $bdd->select($query);
return $result;
}
示例10: init
function init($module, $lang, $language, $idURL, $categorie, $sscategorie, $type, $sort, $order, $page, $settings, $search)
{
$getEntry = Db::select(TABLE_PREFIX . CATEGORIE_NOM, $idURL);
$entry = Db::fetch_row($getEntry);
$getColumn = Db::select(TABLE_PREFIX . CATEGORIE_NOM, "0");
$output = "";
$output = TemplateUpdate::debutupdate($module, $lang, $language, $categorie, $sscategorie, $sort, $order, $page, $idURL, $search);
for ($i = 0; $i < Db::num_fields($getColumn); $i++) {
// Boucle sur les colonnes
$column = Db::fetch_field($getColumn);
$column = $column->name;
$update = $entry[$i];
$column = Utils::findColumn($column, $language);
$field = Utils::findField($column);
// Trouve le type de donné et affiche le input adéquat
if ($field == "id" && $settings['blanc']['showId'] == true || $field != "id") {
if (@(!(include_once 'fields/' . $field . '.field.php'))) {
// Regarde si le champ est prédéfini. Si pas, on utilise le champ txt par défaut
$field = "txt";
} else {
if (class_exists($field)) {
if ($field == "date") {
$update = Utils::datefr($update);
}
$update = stripslashes(htmlentities($update, ENT_QUOTES, "iso-8859-1"));
$getValue = new $field($lang, $update, $column, $idURL, $categorie, $sscategorie, $type, $sort, $page, $settings);
$update = $getValue->update;
$output .= TemplateUpdate::update($update);
}
}
}
}
$output .= TemplateUpdate::finupdate($module, $lang);
return $output;
}
示例11: fetch
/**
* @return array
*/
public function fetch()
{
$query = $this->db->select('*', $this->table, $this->where, $this->order, $this->limit);
$results = $this->db->fetchAssoc($query);
$return = array();
if ($results) {
foreach ($results as $result) {
$item = new $this->class();
foreach ($result as $name => $value) {
$item->{":{$name}"} = $value;
}
$return[] = $item;
}
}
return $return;
}
示例12: listFriend
/**
* 好友列表
*
* @param array $condition 条件数组
* @param string $field 显示字段
* @param obj $obj_page 分页
* @param string $type 查询类型
*/
public function listFriend($condition, $field = '*', $obj_page = '', $type = 'simple')
{
//得到条件语句
$condition_str = $this->getCondition($condition);
$param = array();
switch ($type) {
case 'simple':
$param['table'] = 'sns_friend';
break;
case 'detail':
$param['table'] = 'sns_friend,member';
$param['join_type'] = 'INNER JOIN';
$param['join_on'] = array('sns_friend.friend_tomid=member.member_id');
break;
case 'fromdetail':
$param['table'] = 'sns_friend,member';
$param['join_type'] = 'INNER JOIN';
$param['join_on'] = array('sns_friend.friend_frommid=member.member_id');
break;
}
$param['where'] = $condition_str;
$param['field'] = $field;
$param['order'] = $condition['order'] ? $condition['order'] : 'sns_friend.friend_id desc';
$param['limit'] = $condition['limit'];
$param['group'] = $condition['group'];
$friend_list = Db::select($param, $obj_page);
return $friend_list;
}
示例13: getComplainGoods
public function getComplainGoods($condition = '', $page = '')
{
$param = array();
$param['table'] = 'complain_goods';
$param['where'] = $this->getCondition($condition);
$param['order'] = $condition['order'] ? $condition['order'] : ' complain_goods_id desc ';
return Db::select($param, $page);
}
示例14: rawClientes
public static function rawClientes($where = null)
{
if ($where) {
$sql = Db::select("\n select c.id, c.nome, ci.nome as cidade, uf.uf, ra.ramo_atividade, if(f.cliente_id IS NOT NULL, true, null) as is_fisica, if(j.cliente_id IS NOT NULL, true, null) as is_juridica, j.nome_fantasia, j.inscricao_municipal from cliente c\n left join cliente_pf f on f.cliente_id = c.id\n left join cliente_pj j on j.cliente_id = c.id\n left join ramo_atividade ra on ra.id = c.ramo_atividade_id\n left join cidade ci on ci.id = c.cidade_id\n left join uf on uf.id = c.uf_id\n\n where ativo = '1' and (nome like '%" . $where . "%' or nome_fantasia like '%" . $where . "%' or cidade like '%" . $where . "%' or uf like '%" . $where . "%' or ramo_atividade like '%" . $where . "%')\n\n group by c.id order by c.nome\n\n ");
return $sql;
}
return Db::select("\n select c.id, c.nome, ci.nome as cidade, uf.uf, ra.ramo_atividade, if(f.cliente_id IS NOT NULL, true, null) as is_fisica, if(j.cliente_id IS NOT NULL, true, null) as is_juridica, j.nome_fantasia, j.inscricao_municipal from cliente c\n left join cliente_pf f on f.cliente_id = c.id\n left join cliente_pj j on j.cliente_id = c.id\n left join ramo_atividade ra on ra.id = c.ramo_atividade_id\n left join cidade ci on ci.id = c.cidade_id\n left join uf on uf.id = c.uf_id\n\n where ativo = '1'\n group by c.id order by c.nome\n\n ");
}
示例15: getLinkList
/**
* 列表
*
* @param array $condition 检索条件
* @param obj $page 分页
* @return array 数组结构的返回结果
*/
public function getLinkList($condition,$page=''){
$param = array();
$param['table'] = 'mb_category';
// $param['where'] = $condition_str;
$param['order'] = $condition['order'] ? $condition['order'] : 'gc_id';
$result = Db::select($param,$page);
return $result;
}