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


PHP Zend_Db_Table::fetchRow方法代码示例

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


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

示例1: filter

 /**
  * Returns id by name($value) from table
  *
  * @param  string $value
  * @return string
  */
 public function filter($value)
 {
     if ($value === null) {
         return null;
     }
     $select = $this->_table->select()->where($this->_field . ' = ?', $value);
     $row = $this->_table->fetchRow($select);
     if ($row !== null) {
         return $row[reset($this->_table->info(Zend_Db_Table::PRIMARY))];
     } else {
         return null;
     }
 }
开发者ID:kandy,项目名称:system,代码行数:19,代码来源:NameToId.php

示例2: getThreadFromId

 /**
  * get thread of specific id
  *
  * @param id
  */
 public function getThreadFromId($id)
 {
     if (!$id) {
         return null;
     }
     $threads_table = new Zend_Db_Table('threads');
     $select = $threads_table->select()->where('id = ?', $id);
     return $threads_table->fetchRow($select);
 }
开发者ID:Arteaga2k,项目名称:nolotiro,代码行数:14,代码来源:Message.php

示例3: setup

 /**
  * (non-PHPdoc)
  * @see models/Sahara/Auth/Sahara_Auth_Session::setup()
  */
 public function setup()
 {
     $table = new Zend_Db_Table('users');
     $record = $table->fetchRow($table->select()->where('name = ?', $this->_authType->getUsername())->where('namespace = ?', $this->_config->institution));
     /* User name exists, so no need to create account. */
     if ($record) {
         return;
     }
     $table->insert(array('name' => $this->_authType->getUsername(), 'namespace' => $this->_config->institution, 'persona' => 'USER'));
 }
开发者ID:jeking3,项目名称:web-interface,代码行数:14,代码来源:SaharaAccount.php

示例4: getLastAccess

 public static function getLastAccess($classroomId, $data)
 {
     $access = new Zend_Db_Table('content_access');
     $select = $access->select()->where('classroom_id = ?', $classroomId)->order('content_access.id DESC');
     $row = $access->fetchRow($select);
     if ($row) {
         return self::getPositionById($row->content_id, $data);
     }
     return 0;
 }
开发者ID:ramonornela,项目名称:trilhas,代码行数:10,代码来源:Content.php

示例5: getRol

 /**
  * Retorna el Rol del usuario actual
  * 
  * @return string
  */
 private function getRol()
 {
     $rolStr = 'guest';
     if ($this->_auth->hasIdentity()) {
         $numRol = $this->_auth->getIdentity()->rol;
         $tablaRol = new Zend_Db_Table('roles');
         $rol = $tablaRol->fetchRow($tablaRol->select()->from($tablaRol)->where('idRol = ?', $numRol));
         $rolStr = $rol['rol'];
     }
     return $rolStr;
 }
开发者ID:blackgios,项目名称:General,代码行数:16,代码来源:CheckAccess.php

示例6: indexAction

 public function indexAction()
 {
     $queries = (int) $this->getParam('queries', 1);
     $queries = max(1, $queries);
     $queries = min(500, $queries);
     $table = new Zend_Db_Table('World');
     $worlds = array();
     for ($i = 0; $i < $queries; $i += 1) {
         $worlds[] = $table->fetchRow(array('id = ?' => mt_rand(1, 10000)))->toArray();
     }
     $this->_helper->json->sendJson($worlds);
 }
开发者ID:rappleg,项目名称:FrameworkBenchmarks,代码行数:12,代码来源:DbMultiController.php

示例7: getSection

 /**
  * Получаем информацию о разделе
  *
  * @param int $item_id
  * @param int $menu_id
  * 
  * @return array
  */
 public function getSection($item_id, $menu_id)
 {
     $menu = $this->getMenu($menu_id);
     if ($menu->type == 'router') {
         // получаем разделы меню привязонного к маршруту
         $item = $this->_modelItems->fetchRow($this->_modelItems->select()->where('route_id = ?', $item_id)->where('menu_id = ?', $menu->menu_id));
         $itemRoute = Modules_Router_Model_Router::getInstance()->getItem($item_id);
         $return = $item ? $item->toArray() + $itemRoute : $itemRoute;
         $return['type'] = 'router';
         $return['parent_id'] = $itemRoute['parent_route_id'];
         $return['name_route'] = $itemRoute['name'];
         $return['name'] = $item['name'] ? $item['name'] : $itemRoute['name'];
         unset($return['parent_route_id'], $return['childs']);
     } else {
         $return = $this->_modelItems->fetchRow($this->_modelItems->select()->where('item_id = ?', $item_id))->toArray();
     }
     return $return;
 }
开发者ID:kytvi2p,项目名称:ZettaFramework,代码行数:26,代码来源:Menu.php

示例8: signAction

 public function signAction()
 {
     $data = array();
     if ($this->_hasParam('id')) {
         $id = Zend_filter::filterStatic($this->_getParam('id'), 'int');
         if (Application_Model_Classroom::isAvailable($id)) {
             $session = new Zend_Session_Namespace('data');
             $session->classroom_id = $id;
             $classroom = new Zend_Db_Table('classroom');
             $row = $classroom->fetchRow(array('id = ?' => $id));
             if (PAYMENT && $row->amount && $row->amount > 0) {
                 $this->_redirect('/classroom/pay');
             } else {
                 $this->_redirect('/classroom/register');
             }
         }
     }
     $this->view->messages = array('Unavailable');
 }
开发者ID:ramonornela,项目名称:trilhas,代码行数:19,代码来源:ClassroomController.php

示例9: isDisabled

 /**
  * Checks if the user still has attempted and period
  *
  * @param integer $userId
  * @param integer $exerciseId
  */
 public static function isDisabled($userId, $exerciseId)
 {
     $exercise = new Zend_Db_Table('exercise');
     $db = Zend_Db_Table::getDefaultAdapter();
     $select = $db->select()->from('exercise_note', 'COUNT(0) as total')->where('user_id = ?', $userId)->where('exercise_id = ?', $exerciseId);
     $result = $db->fetchRow($select);
     $where = array('id = ?' => $exerciseId, 'begin  <= ?' => date('Y-m-d'), 'end >= ? OR end IS NULL' => date('Y-m-d'));
     $row = $exercise->fetchRow($where);
     if ($row) {
         if ($row->attempts === "0" || (int) $result['total'] < (int) $row->attempts) {
             return false;
         } else {
             return 'Number of attempts exec';
         }
     } else {
         return 'Expired period';
     }
     return false;
 }
开发者ID:ramonornela,项目名称:trilhas,代码行数:25,代码来源:Reply.php

示例10: authenticate

 /**
  * Returns true if the user can be authenticaed using the
  * supplied credential. The tests for success with this authentication
  * type are:
  * <ol>
  * 	<li>The user must exist.</li>
  * 	<li>The user must have database authorisation enabled
  * 	(auth_allowed = true).</li>
  *  <li>The password must match the record password.</li>
  * </ol>
  *
  * @return boolean true if the user is authenticated
  * @see models/Sahara/Auth/Sahara_Auth_Type::authenticate()
  */
 public function authenticate()
 {
     $table = new Zend_Db_Table('users');
     $this->_record = $table->fetchRow($table->select()->where('name = ?', $this->_user)->where('namespace = ?', $this->_config->institution));
     /* 1) User must exist. */
     if ($this->_record == null) {
         return false;
     }
     $allowed = (int) $this->_record->auth_allowed;
     if (is_string($allowed)) {
         $allowed = (int) $allowed && true;
     }
     /* 2) Authorisation must be enabled. */
     if (!$allowed) {
         return false;
     }
     /* 3) Passwords must match. */
     return $this->_record->password == sha1($this->_pass);
 }
开发者ID:jeking3,项目名称:web-interface,代码行数:33,代码来源:Database.php

示例11: getAdforSearch

 public function getAdforSearch($id, $ad_type, $woeid)
 {
     $id = (int) $id;
     $ad_type = (int) $ad_type;
     $woeid = (int) $woeid;
     $table = new Zend_Db_Table('ads');
     $select = $table->select()->setIntegrityCheck(false);
     $select->from(array('a' => 'ads'), array('a.*'));
     $select->joinLeft(array('u' => 'users'), 'a.user_owner = u.id', array('u.username'));
     $select->joinLeft(array('c' => 'commentsAdCount'), 'a.id = c.id_comment', array('c.count as comments_count'));
     $select->joinLeft(array('r' => 'readedAdCount'), 'a.id = r.id_ad', array('r.counter as readings_count'));
     $select->where('a.id = ?', $id);
     $select->where('a.type = ?', $ad_type);
     $select->where('a.woeid_code = ?', $woeid);
     //show only if user is active and not locked
     //$select->where('u.active = ?', 1);
     //$select->where('u.locked = ?', 0);
     $result = $table->fetchRow($select);
     if (!is_null($result)) {
         $result = $result->toArray();
     }
     return $result;
 }
开发者ID:Arteaga2k,项目名称:nolotiro,代码行数:23,代码来源:Ad.php

示例12: checkUser

 /**
  * Verify if user with given $id exists and has specified $password
  *
  * @param string $id user identity URL
  * @param string $password user password
  * @return bool
  */
 public function checkUser($id, $password)
 {
     $select = $this->_usersTable->select()->where('openid = ?', $id)->where('password = ?', $password);
     $row = $this->_usersTable->fetchRow($select);
     return $row == null;
 }
开发者ID:heiglandreas,项目名称:Zend-Framework-OpenID-Provider,代码行数:13,代码来源:Db.php

示例13: _getFormConfig

 /**
  * @description inject factor fields into form
  * @param array $formConfig
  * @param object $table
  * @param string $action
  * @param object $config
  * @param array $params
  * @return
  * @author Se#
  * @version 0.0.1
  */
 protected function _getFormConfig()
 {
     $config = self::$_info['config'];
     $params = self::$_info['params'];
     $factors = $this->_getFactorsList($config);
     $formConfig = array('class' => 'factor_form', 'elements' => array('do' => array('type' => 'hidden', 'options' => array('value' => 'factor'))));
     $formConfig['elements']['factorobjectId'] = array('type' => 'hidden', 'options' => array('value' => $params['id']));
     $formConfig['elements']['factorobjectTable'] = array('type' => 'hidden', 'options' => array('value' => Evil_DB::scope2table($params['controller'])));
     $formConfig['elements']['factortype'] = array('type' => 'select', 'options' => array('label' => 'Choose factor type', 'multiOptions' => $factors));
     $formConfig['elements']['factorcontent'] = array('type' => 'textarea', 'options' => array('rows' => '5', 'cols' => 40));
     $userTable = new Zend_Db_Table(Evil_DB::scope2table('user'));
     $user = $userTable->fetchRow('id="' . Zend_Registry::get('userid') . '"');
     if (!$user) {
         $userName = 'Guest';
     } else {
         $user = $user->toArray();
         $userName = isset($user['nickname']) ? $user['nickname'] : 'User';
     }
     $formConfig['elements']['factorauthor'] = array('type' => 'text', 'options' => array('label' => 'Please, introduce yourself', 'value' => $userName, 'readOnly' => true));
     $formConfig['elements']['submit'] = array('type' => 'submit', 'options' => array('label' => 'Add'));
     return $formConfig;
 }
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:33,代码来源:Factor.php

示例14: strtolower

    if (!empty($methodName)) {
        $methodName = strtolower($methodName[0]) . substr($methodName, 1);
    }
}
if (empty($packageName) || empty($methodName)) {
    header('HTTP/1.1 400 Bad Request');
    die("Invalid package or method");
}
//initialize database adapter
$dbAdapter = new Zend_Db_Adapter_Pdo_Mysql(array('host' => DB_HOST, 'dbname' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'charset' => 'utf8'));
Zend_Db_Table::setDefaultAdapter($dbAdapter);
session_start();
$userId = isset($_SESSION['userId']) ? $_SESSION['userId'] : null;
if (!empty($userId)) {
    $userTable = new Zend_Db_Table('User');
    $currentUser = $userTable->fetchRow($userTable->select()->from($userTable, array('id', 'email', 'fullname', 'isSupporter'))->where('id = ?', $userId));
    if (!empty($currentUser)) {
        Zend_Registry::set('currentUser', $currentUser);
    }
}
include_once 'acl.php';
$code = isAllowed($packageName, $methodName);
if ($code != 200) {
    header("HTTP/1.1 {$code} " . httpStatusCode($code));
    die;
}
//init the handler instance from packageName
$packagePath = implode(DIRECTORY_SEPARATOR, array(DIR_ROOT, 'handlers', $packageName)) . '.php';
if (!file_exists($packagePath)) {
    header('HTTP/1.1 404 Not Found');
    die("{$pkgName} is not found!");
开发者ID:Brother-Simon,项目名称:web-fullstack-bundle,代码行数:31,代码来源:index.php

示例15: indexAction

 public function indexAction()
 {
     $table = new Zend_Db_Table('World');
     $result = $table->fetchRow(array('id = ?' => mt_rand(1, 10000)));
     $this->_helper->json->sendJson($result->toArray());
 }
开发者ID:rappleg,项目名称:FrameworkBenchmarks,代码行数:6,代码来源:DbController.php


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