当前位置: 首页>>代码示例>>PHP>>正文


PHP DB::getResults方法代码示例

本文整理汇总了PHP中DB::getResults方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::getResults方法的具体用法?PHP DB::getResults怎么用?PHP DB::getResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB的用法示例。


在下文中一共展示了DB::getResults方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCustomFields

 /**
  * Devolver los datos de definiciones de campos personalizados
  *
  * @param int        $customFieldId El id del campo personalizado
  * @param bool|false $returnRawData Devolver los datos de la consulta sin formatear
  * @return array|bool
  */
 public static function getCustomFields($customFieldId = null, $returnRawData = false)
 {
     $query = 'SELECT customfielddef_id, customfielddef_module, customfielddef_field FROM customFieldsDef';
     if (!is_null($customFieldId)) {
         $query .= ' WHERE customfielddef_id = :id LIMIT 1';
         $data['id'] = $customFieldId;
     } else {
         $query .= ' ORDER BY customfielddef_module';
     }
     if (!$returnRawData) {
         DB::setReturnArray();
     }
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     if ($queryRes === false) {
         return array();
     }
     if (!$returnRawData) {
         $customFields = array();
         foreach ($queryRes as $customField) {
             /**
              * @var CustomFieldDef
              */
             $field = unserialize($customField->customfielddef_field);
             $attribs = new \stdClass();
             $attribs->id = $customField->customfielddef_id;
             $attribs->module = self::getFieldsModules($customField->customfielddef_module);
             $attribs->name = $field->getName();
             $attribs->typeName = self::getFieldsTypes($field->getType(), true);
             $attribs->type = $field->getType();
             $customFields[] = $attribs;
         }
         return $customFields;
     }
     return $queryRes;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:42,代码来源:CustomFieldDef.class.php

示例2: getTags

 /**
  *
  * @param string $order
  * @param int $limit Default is 10
  * @return object|null
  */
 public function getTags($order, $limit = 10)
 {
     if (!Config::get('home' . ucfirst($order), 'tags')) {
         return NULL;
     }
     if ($order == 'latest') {
         DB::select('tag');
         DB::from('tag');
         DB::orderBy('id', 'desc');
     } else {
         if ($order == 'random') {
             $range = $this->_tagsRandomRange();
             DB::select('tag');
             DB::from('tag');
             DB::whereGreaterEqual('id', $range['start']);
             DB::whereLessEqual('id', $range['end']);
             DB::orderBy('id', 'rand');
         }
     }
     $configLimit = Config::get('home' . ucfirst($order) . 'Limit', 'tags');
     if ($configLimit) {
         $limit = $configLimit;
     }
     DB::limit($limit);
     DB::run();
     return DB::getResults();
 }
开发者ID:khalid9th,项目名称:ocAds,代码行数:33,代码来源:mHome.php

示例3: checkHashPassRecover

 /**
  * Comprobar el hash de recuperación de clave.
  *
  * @param string $hash con el hash de recuperación
  * @return int con el Id del usuario
  */
 public static function checkHashPassRecover($hash)
 {
     $query = 'SELECT userpassr_userId FROM usrPassRecover ' . 'WHERE userpassr_hash = :hash ' . 'AND userpassr_used = 0 ' . 'AND userpassr_date >= :date ' . 'ORDER BY userpassr_date DESC LIMIT 1';
     $data['hash'] = $hash;
     $data['date'] = time() - self::MAX_PASS_RECOVER_TIME;
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     if ($queryRes === false) {
         return false;
     }
     return $queryRes->userpassr_userId;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:17,代码来源:UserPassRecover.class.php

示例4: login

 public function login($username = null, $password = null)
 {
     // testa token do formulário
     if (!check_token($_POST['token'])) {
         return false;
     }
     // verificar se username existe
     $user = $this->findByUsername($username);
     if (is_numeric($user->id)) {
         // verificar senha digitada
         if (!$password) {
             return false;
         }
         $this->db->query("SELECT password FROM users WHERE id = :id", array(array('name' => 'id', 'value' => $user->id)));
         $res = $this->db->getResults();
         if ($this->db->isOk() && password_verify($password, $res->password)) {
             $_SESSION["user"] = $user->id;
             return true;
         }
     }
     return false;
 }
开发者ID:VictorSebben,项目名称:minicurso,代码行数:22,代码来源:User.php

示例5: migrateUsersGroup

 /**
  * Migrar el grupo de los usuarios a la nueva tabla
  */
 public static function migrateUsersGroup()
 {
     $query = 'SELECT user_id, user_groupId FROM usrData';
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     if ($queryRes === false) {
         return false;
     }
     foreach ($queryRes as $user) {
         if (!Groups::addUsersForGroup(array($user->user_groupId), $user->user_id)) {
             Log::writeNewLog(_('Migrar Grupos'), sprintf('%s (%s)'), _('Error al migrar grupo del usuario'), $user->user_id);
         }
     }
     return true;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:17,代码来源:UserMigrate.class.php

示例6: getEvents

 /**
  * Obtener los eventos guardados.
  *
  * @param int $start con el número de registro desde el que empezar
  * @return false|array con el resultado de la consulta
  */
 public static function getEvents($start)
 {
     $query = 'SELECT ' . 'log_id,' . 'FROM_UNIXTIME(log_date) as log_date,' . 'log_action,' . 'log_login,' . 'log_ipAddress,' . 'log_description ' . 'FROM log ' . 'ORDER BY log_id DESC ' . 'LIMIT :start, 50';
     $data['start'] = $start;
     // Obtenemos el número total de registros
     DB::setFullRowCount();
     // Devolver un array siempre
     DB::setReturnArray();
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     if ($queryRes === false) {
         return false;
     }
     self::$numRows = DB::$lastNumRows;
     return $queryRes;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:21,代码来源:Log.class.php

示例7: getUserMPass

 /**
  * Desencriptar la clave maestra del usuario para la sesión.
  *
  * @param bool $showPass opcional, para devolver la clave desencriptada
  * @return false|string Devuelve bool se hay error o string si se devuelve la clave
  */
 public function getUserMPass($showPass = false)
 {
     $query = 'SELECT user_mPass, user_mIV FROM usrData WHERE user_id = :id LIMIT 1';
     $data['id'] = $this->_userId;
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     if ($queryRes === false) {
         return false;
     }
     if ($queryRes->user_mPass && $queryRes->user_mIV) {
         $clearMasterPass = Crypt::getDecrypt($queryRes->user_mPass, $queryRes->user_mIV, $this->getCypherPass());
         if (!$clearMasterPass) {
             return false;
         }
         return $showPass === true ? $clearMasterPass : SessionUtil::saveSessionMPass($clearMasterPass);
     }
     return false;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:23,代码来源:User.class.php

示例8: getCategories

 /**
  * Obtiene el listado de categorías.
  *
  * @param int  $id            con el Id de la categoría
  * @param bool $retAssocArray para devolver un array asociativo
  * @return array con el id de categoria como clave y en nombre como valor
  */
 public static function getCategories($id = null, $retAssocArray = false)
 {
     $query = 'SELECT category_id, category_name,category_description FROM categories ';
     $data = null;
     if (!is_null($id)) {
         $query .= "WHERE category_id = :id LIMIT 1";
         $data['id'] = $id;
     } else {
         $query .= "ORDER BY category_name";
     }
     DB::setReturnArray();
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     if ($queryRes === false) {
         return array();
     }
     if ($retAssocArray) {
         $resCategories = array();
         foreach ($queryRes as $category) {
             $resCategories[$category->category_id] = $category->category_name;
         }
         return $resCategories;
     }
     return $queryRes;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:31,代码来源:Category.class.php

示例9: DB

<?php

require_once 'DB.php';
$db = new DB('host', 'username', 'password', 'database');
if (isset($_GET['code'])) {
    $taintedCode = $_GET['code'];
    header('Content-Type: application/json');
    if (preg_match('/^\\d{4}$/', $taintedCode) && strlen($taintedCode) == 4) {
        $rawIntCode = intval($taintedCode);
        $strCode = '';
        if (filter_var($rawIntCode, FILTER_VALIDATE_INT)) {
            $strCode = $rawIntCode;
            $query = "SELECT product_name, product_price FROM products WHERE product_code = '{$strCode}'";
            $results = $db->getResults($query);
            $output = array();
            foreach ($results as $result) {
                $output['name'] = $result['product_name'];
                $output['price'] = $result['product_price'];
            }
            echo json_encode($output);
        }
    }
}
开发者ID:alansutherland,项目名称:Code-On-Demand,代码行数:23,代码来源:ajax.php

示例10: DB

<?php

require_once 'DB.php';
$db = new DB('host', 'username', 'password', 'database');
$productCodes = $db->getResults("SELECT product_code FROM products");
?>
<!DOCTYPE html>
<html>
<head>
  <title>jQuery: AJAX autocomplete for e-commerce products</title>
  <meta charset="utf-8" />
  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
  <script type="text/javascript" src="js/autoproducts.js"></script>
</head>
<body>
<form action="" method="post" id="cart">
	<div>
		<input type="text" name="code" id="code" placeholder="Product Code" />
		<div id="name"></div>
		<div id="price"></div>
		<input type="submit" value="Add to cart" />
	</div>
	<h3>Available product codes</h3>
	<ul id="codes">
	<?php 
$html = '';
foreach ($productCodes as $productCode) {
    $code = $productCode['product_code'];
    $html .= sprintf('<li>%s</li>', $code);
}
开发者ID:alansutherland,项目名称:Code-On-Demand,代码行数:31,代码来源:index.php

示例11: checkUserIsLDAP

 /**
  * Comprobar si un usuario autentifica mediante LDAP
  * .
  *
  * @param string $userLogin con el login del usuario
  * @return bool
  */
 public static function checkUserIsLDAP($userLogin)
 {
     $query = 'SELECT BIN(user_isLdap) AS user_isLdap FROM usrData WHERE user_login = :login LIMIT 1';
     $data['login'] = $userLogin;
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     return $queryRes !== false && intval($queryRes->user_isLdap) === 1;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:14,代码来源:UserLdap.class.php

示例12: getAccountsData

 /**
  * Obtener los datos de todas las cuentas
  *
  * @return array
  * @throws SPException
  */
 public static function getAccountsData()
 {
     $query = 'SELECT account_id,' . 'account_name,' . 'account_categoryId,' . 'account_customerId,' . 'account_login,' . 'account_url,' . 'account_pass,' . 'account_IV,' . 'account_notes ' . 'FROM accounts';
     DB::setReturnArray();
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     if ($queryRes === false) {
         throw new SPException(SPException::SP_CRITICAL, _('No se pudieron obtener los datos de las cuentas'));
     }
     return $queryRes;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:16,代码来源:Account.class.php

示例13: getValue

 /**
  * Obtiene un valor desde la configuración en la BBDD.
  *
  * @param string $param con el parámetro de configuración
  * @param string $default El valor por defecto
  * @return false|string con el valor
  */
 public static function getValue($param, $default = null)
 {
     $query = 'SELECT config_value FROM config WHERE config_parameter = :parameter LIMIT 1';
     $data['parameter'] = $param;
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     if ($queryRes === false) {
         return false;
     }
     return $queryRes->config_value ? $queryRes->config_value : $default;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:17,代码来源:ConfigDB.class.php

示例14: getProfileNameById

 /**
  * Obtener el nombre de un perfil por a partir del Id.
  *
  * @param int $id con el Id del perfil
  * @return false|string con el nombre del perfil
  */
 public static function getProfileNameById($id)
 {
     $query = 'SELECT userprofile_name FROM usrProfiles WHERE userprofile_id = :id LIMIT 1';
     $data['id'] = $id;
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     if ($queryRes === false) {
         return false;
     }
     return $queryRes->userprofile_name;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:16,代码来源:Profile.class.php

示例15: getPreferences

 /**
  * Obtener las preferencas de un usuario
  *
  * @param $id int El id del usuario
  * @return bool|UserPreferences
  * @throws SPException
  */
 public static function getPreferences($id)
 {
     $query = 'SELECT user_preferences FROM usrData WHERE user_id = :id LIMIT 1';
     $data['id'] = $id;
     $queryRes = DB::getResults($query, __FUNCTION__, $data);
     if ($queryRes === false) {
         return new UserPreferences();
         //            throw new SPException(SPException::SP_WARNING, _('Datos de preferencias incorrectos'));
     }
     $preferences = unserialize($queryRes->user_preferences);
     if (!$preferences instanceof UserPreferences) {
         return new UserPreferences();
     }
     return $preferences;
 }
开发者ID:bitking,项目名称:sysPass,代码行数:22,代码来源:UserPreferences.class.php


注:本文中的DB::getResults方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。