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


PHP object::fetchRow方法代码示例

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


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

示例1: calculateViaSQL

 /**
  *
  * execute a SQL query in the form SELECT $formula as Result
  *
  * @param model class $model
  * @param string $formula A string that is a formula like 2+3
  * @return mixed. The array of queries
  */
 public function calculateViaSQL(Model $model, $formula)
 {
     $formula = "Select " . $formula . " as Result;";
     $result = $this->dbo->fetchRow($formula);
     if (empty($result)) {
         return false;
     } else {
         return (string) $result[0]['Result'];
     }
 }
开发者ID:simkimsia,项目名称:queryable,代码行数:18,代码来源:QueryableBehavior.php

示例2: rs2xml

/**
* Creates XML from the ADODB record set
*
* @param     object         $rs         - record set object
* @param     bool        $moveFirst    - determines whether recordset is returned to first record
* @return     string        $xml        - resulting xml
* @version V1.0  10 June 2006  (c) 2006 Rich Zygler ( http://www.boringguys.com/ ). All rights reserved.
*
*    Released under both BSD license and Lesser GPL library license. You can choose which license
*    you prefer.
*/
function rs2xml($rs, $moveFirst = false)
{
    if (!$rs) {
        printf(ADODB_BAD_RS, 'rs2xml');
        return false;
    }
    $xml = '';
    $totalRows = 0;
    $totalRows = $rs->numrows();
    $domxml = new DOMDocument('1.0', 'utf-8');
    $root = $domxml->appendChild($domxml->createElement('rows'));
    $root->setAttribute('total-rows', $totalRows);
    $row_count = 1;
    while ($line = $rs->fetchRow()) {
        $row = $root->appendChild($domxml->createElement('row'));
        foreach ($line as $col_key => $col_val) {
            $col = $row->appendChild($domxml->createElement('column'));
            $col->setAttribute('name', strtolower($col_key));
            $col->appendChild($domxml->createTextNode($col_val));
        }
        $row_count++;
    }
    $domxml->formatOutput = true;
    $xml = $domxml->saveXML();
    $domxml = null;
    if ($moveFirst) {
        $rs->MoveFirst();
    }
    return $xml;
}
开发者ID:alexromo,项目名称:apryl-asistencias,代码行数:41,代码来源:toxml.inc.php

示例3: selectRow

 /**
  * Run a query and return a single row
  *
  * @param string $sql
  * @return array
  */
 function selectRow($sql)
 {
     $this->debug['queries']++;
     $this->debug['actualQueries'][] = $sql;
     $c = $this->db->fetchRow($sql);
     return $c;
 }
开发者ID:basdog22,项目名称:Qool,代码行数:13,代码来源:Action.php

示例4: getVariable

 /**
  * get the mysql variable
  *
  * @access public
  * @param string name variable name
  * @return string variable
  */
 function getVariable($name)
 {
     $sql = 'SHOW VARIABLES LIKE \'' . $name . '\'';
     $res = $this->_db->queryF($sql);
     while (list($key, $value) = $this->_db->fetchRow($res)) {
         $variable[$key] = $value;
     }
     return $variable[$name];
 }
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:16,代码来源:mysqlinfo.class.php

示例5: read

 /**
  * Read a session from the database
  * 
  * @param	string  &sess_id    ID of the session
  * 
  * @return	array   Session data
  */
 function read($sess_id)
 {
     $sql = sprintf('SELECT sess_data FROM %s WHERE sess_id = %s', $this->db->prefix('session'), $this->db->quoteString($sess_id));
     if (false != ($result = $this->db->query($sql))) {
         if (list($sess_data) = $this->db->fetchRow($result)) {
             return $sess_data;
         }
     }
     return '';
 }
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:17,代码来源:session.php

示例6: getFootage

 /**
  * Load this object
  * @since Version 3.10.0
  * @return void;
  */
 private function getFootage()
 {
     $data = $this->db->fetchRow("SELECT * FROM railcam_footage WHERE id = ?", $this->id);
     $data['fileinfo'] = json_decode($data['fileinfo'], true);
     $this->timeStamp = new DateTime($data['datestored']);
     $this->setCamera(new Camera($data['railcam_id']));
     $this->type = $data['type'];
     $storageObject = new Storage($data['storage_id']);
     $this->footageData = ["id" => $data['id'], "camera" => $this->cameraObject->getArray(), "type" => $this->type, "url" => ["original" => $storageObject->getWebUrl($data['fileinfo'])]];
     return;
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:16,代码来源:Footage.php

示例7: array

 /**
  * 获取所有的fields
  *
  * @access  public
  * @param   string      $table_name      数据表名
  * @return  array
  */
 function get_fields($table_name)
 {
     $fields = array();
     $result = $this->db->query("SHOW FIELDS FROM {$table_name}", 'SILENT');
     if ($result) {
         while ($row = $this->db->fetchRow($result)) {
             $fields[] = $row['Field'];
         }
     }
     return $fields;
 }
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:18,代码来源:cls_sql_executor.php

示例8: __construct

 /**
  * Constructor
  *
  * @param 	array	Options containing 'table', 'name'
  */
 public function __construct(array $options = array())
 {
     // Initialize the options
     $options = $this->_initialize($options);
     // Mixin the KMixinClass
     $this->mixin(new KMixinClass($this, 'Rowset'));
     // Assign the classname with values from the config
     $this->setClassName($options['name']);
     // Set table object and class name
     $this->_tableClass = 'com.' . $this->getClassName('prefix') . '.table.' . $this->getClassName('suffix');
     $this->_table = isset($options['table']) ? $options['table'] : KFactory::get($this->_tableClass);
     // Set the data
     if (isset($options['data'])) {
         $this->_data = $options['data'];
     }
     // Count the data
     $this->resetCount();
     // Instantiate an empty row to use for cloning later
     $this->_emptyRow = $this->_table->fetchRow();
 }
开发者ID:janssit,项目名称:www.gincoprojects.be,代码行数:25,代码来源:abstract.php

示例9: getCount

 /**
  * count objects matching a criteria
  *
  * @param object $criteria {@link CriteriaElement} to match
  * @return int count of objects
  * @access public
  */
 function getCount($criteria = null)
 {
     $sql = 'SELECT COUNT(*) FROM ' . $this->_db->prefix($this->_dbtable);
     if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
         $sql .= ' ' . $criteria->renderWhere();
     }
     if (!($result =& $this->_db->query($sql))) {
         return 0;
     }
     list($count) = $this->_db->fetchRow($result);
     return $count;
 }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:19,代码来源:baseObjectHandler.php

示例10: getCount

 /**
  * Count the number of online users
  * 
  * @param	object  $criteria   {@link CriteriaElement} 
  */
 function getCount($criteria = null)
 {
     $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('online');
     if (is_object($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
         $sql .= ' ' . $criteria->renderWhere();
     }
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     list($ret) = $this->db->fetchRow($result);
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:xoops4-svn,代码行数:17,代码来源:online.php

示例11: array

 /**
  * 获得用于验证身份的信息
  *
  * @access  private
  * @return  string or boolean   成功返回用于登录短信服务的帐号信息,失败返回false。
  */
 function get_login_info()
 {
     $sql = 'SELECT `code`, `value` FROM ' . $this->ecs->table('shop_config') . " WHERE `code` = 'sms_user_name' OR `code` = 'sms_password'";
     $result = $this->db->query($sql);
     $retval = array();
     if (!empty($result)) {
         while ($temp_arr = $this->db->fetchRow($result)) {
             $retval[$temp_arr['code']] = $temp_arr['value'];
         }
         return base64_encode($retval['sms_user_name'] . "\t" . $retval['sms_password']);
     }
     return false;
 }
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:19,代码来源:cls_sms.php

示例12: calculateTotal

 /**
  * calculateTotal()
  * Calculate totlas
  * @access public
  * @return type
  */
 private function calculateTotal()
 {
     if (!$this->totalPages) {
         $this->query = new \NG\Query();
         $this->query->select("COUNT(*) as total")->from($this->table);
         if (isset($this->where)) {
             $this->query->where($this->where);
         }
         $result = $this->db->fetchRow($this->query->__toString());
         $this->totalCount = $result['total'];
         $this->totalPages = ceil($this->totalCount / $this->itemsPerPage);
     }
     return $this->totalPages;
 }
开发者ID:reang,项目名称:NG-Framework,代码行数:20,代码来源:Pagination.php

示例13: write

 /**
  * Write a session to the database
  *
  * @param   string  $sess_id
  * @param   string  $sess_data
  *
  * @return  bool
  **/
 function write($sessionId, $data)
 {
     $sessionId = $this->db->quote($sessionId);
     $data = $this->db->quote($data);
     $time = time();
     list($count) = $this->db->fetchRow($this->db->query("SELECT COUNT(*) FROM `{$this->tableName}` WHERE sess_id={$sessionId}"));
     if ($count > 0) {
         $sql = "UPDATE `{$this->tableName}` SET sess_updated={$time},sess_data={$data} WHERE sess_id={$sessionId}";
     } else {
         $ip = $this->db->quote($_SERVER['REMOTE_ADDR']);
         $sql = "INSERT INTO `{$this->tableName}` (sess_id,sess_updated,sess_ip,sess_data) VALUES ({$sessionId},{$time},{$ip},{$data})";
     }
     return $this->db->queryF($sql);
 }
开发者ID:BackupTheBerlios,项目名称:xoops4-svn,代码行数:22,代码来源:handler-db.php

示例14: write

 /**
  * Write a session to the database
  * 
  * @param   string  $sess_id
  * @param   string  $sess_data
  * 
  * @return  bool    
  **/
 function write($sess_id, $sess_data)
 {
     global $HTTP_SERVER_VARS;
     list($count) = $this->db->fetchRow($this->db->query("SELECT COUNT(*) FROM " . $this->db->prefix('session') . " WHERE sess_id='" . $sess_id . "'"));
     if ($count > 0) {
         $sql = sprintf("UPDATE %s SET sess_updated = %u, sess_data = '%s' WHERE sess_id = '%s'", $this->db->prefix('session'), time(), $sess_data, $sess_id);
     } else {
         $sql = sprintf("INSERT INTO %s (sess_id, sess_updated, sess_ip, sess_data) VALUES ('%s', %u, '%s', '%s')", $this->db->prefix('session'), $sess_id, time(), $HTTP_SERVER_VARS['REMOTE_ADDR'], $sess_data);
     }
     if (!$this->db->queryF($sql)) {
         return false;
     }
     return true;
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:22,代码来源:session.php

示例15: write

 /**
  * Write a session to the database
  * 
  * @param   string  $sess_id
  * @param   string  $sess_data
  * 
  * @return  bool    
  **/
 function write($sess_id, $sess_data)
 {
     $sess_id = $this->db->quoteString($sess_id);
     list($count) = $this->db->fetchRow($this->db->query("SELECT COUNT(*) FROM " . $this->db->prefix('session') . " WHERE sess_id=" . $sess_id));
     if ($count > 0) {
         $sql = sprintf('UPDATE %s SET sess_updated = %u, sess_data = %s WHERE sess_id = %s', $this->db->prefix('session'), time(), $this->db->quoteString($sess_data), $sess_id);
     } else {
         $sql = sprintf('INSERT INTO %s (sess_id, sess_updated, sess_ip, sess_data) VALUES (%s, %u, %s, %s)', $this->db->prefix('session'), $sess_id, time(), $this->db->quoteString($_SERVER['REMOTE_ADDR']), $this->db->quoteString($sess_data));
     }
     if (!$this->db->queryF($sql)) {
         return false;
     }
     return true;
 }
开发者ID:hiro1173,项目名称:legacy,代码行数:22,代码来源:session.php


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