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


PHP Query::fetch方法代码示例

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


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

示例1: fetch_data

 public function fetch_data($UID = NULL)
 {
     $param = [$UID == NULL ? $this->UID : $UID];
     //This is an array containing the UID parameter for the query, if the function argument is null it uses the object's uid
     $query = "SELECT * FROM notes WHERE UID = ?";
     $handle = new Query($this->pdo, $query);
     $handle->exec($param);
     if (!($result = $handle->fetch())) {
         return false;
     }
     $this->_copy($result);
     return true;
 }
开发者ID:hrn4n,项目名称:argon,代码行数:13,代码来源:note.class.php

示例2: fetch

 /**
  * Returns the next row of data from the current query, always in the
  * form of an object, with each column as its properties.
  *
  * MISSING: ($offset, $limit) optional parameters
  * 
  * @access	public
  * @return	object
  * 
  */
 function fetch()
 {
     if ($this->result) {
         switch ($this->cache_action) {
             case 0:
                 //print_r ($this);
                 return @pg_fetch_object($this->result);
             case 1:
                 //print_r ($this);
                 return parent::fetch();
             case 2:
                 //print_r ($this);
                 $this->_row = @pg_fetch_object($this->result);
                 return parent::fetch();
             case 3:
                 //print_r ($this);
                 $this->_row = @pg_fetch_object($this->result);
                 return parent::fetch();
         }
     } else {
         //print_r ($this);
         return 0;
     }
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:34,代码来源:PgSQL.php

示例3: fetch

 /**
  * Returns the next row of data from the current query, always in the
  * form of an object, with each column as its properties.
  * 
  * @access	public
  * @return	object
  * 
  */
 function fetch($offset = 0, $limit = 0)
 {
     if ($this->result) {
         if ($limit > 0) {
             $res = array();
             $c = 0;
             while ($row = $this->fetch()) {
                 if ($c < $offset) {
                     $c++;
                     continue;
                 } elseif ($c >= $offset + $limit) {
                     break;
                 }
                 $res[] = $row;
                 $c++;
             }
             return $res;
         }
         switch ($this->cache_action) {
             case 0:
                 //print_r ($this);
                 return @$this->_fetchModeFunctions[db_fetch_mode()]($this->result);
             case 1:
                 //print_r ($this);
                 return parent::fetch();
             case 2:
                 //print_r ($this);
                 $this->_row = @$this->_fetchModeFunctions[db_fetch_mode()]($this->result);
                 return parent::fetch();
             case 3:
                 //print_r ($this);
                 $this->_row = @$this->_fetchModeFunctions[db_fetch_mode()]($this->result);
                 return parent::fetch();
         }
     } else {
         //print_r ($this);
         return 0;
     }
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:47,代码来源:MySQL.php

示例4: getAssetParentId

 /**
  * Gets the parent asset id for the record
  *
  * @return  int
  * @since   2.0.0
  */
 private function getAssetParentId()
 {
     $assetId = null;
     // Build the query to get the asset id for the parent category
     $query = new Query();
     $query->select('id')->from('#__assets')->whereEquals('name', 'com_' . $this->model->getNamespace());
     if ($results = $query->fetch()) {
         $result = $results[0];
         $assetId = (int) $result->id;
     }
     return $assetId ? $assetId : $this->getRootId();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:18,代码来源:Asset.php

示例5: existe_manche_de_finale

function existe_manche_de_finale($database, $idt, $jpt, $lb)
{
    if ($jpt > 1) {
        //SQL query to count ???
        $sql_func = 'SELECT COUNT(*) as nbr
                FROM manches_equipes as me, matchs as m
                WHERE m.id_tournoi=:idt AND m.id_groupe IS NULL AND me.id_match=m.id_match AND m.looser_bracket=:lb';
    } else {
        //SQL query to count ???
        $sql_func = 'SELECT COUNT(*) as nbr
                FROM manches_joueurs as mj, matchs as m
                WHERE m.id_tournoi=:idt AND m.id_groupe IS NULL AND mj.id_match=m.id_match AND m.looser_bracket=:lb';
    }
    $query_func = new Query($databse, $sql_func);
    $query_func->bind(':idt', $idt, PDO::PARAM_INT);
    $query_func->bind(':lb', $lb, PDO::PARAM_INT);
    if ($query_func->execute()) {
        $nbr = $query_func->fetch(PDO::FETCH_ASSOC);
    } else {
        global $glob_debug;
        if ($glob_debug) {
            echo 'ERREUR - EXISTE MANCHE GROUPE TEAM SQL';
        }
        exit;
    }
    $nbr = $nbr['nbr'];
    if ($nbr == 0) {
        return false;
    } else {
        return true;
    }
}
开发者ID:HehLan,项目名称:Intranet-5.0,代码行数:32,代码来源:utils.php

示例6: Query

<?php

/*
 * Testing a few simple queries to see if the Query wrapper class works properly
 */
include "../src/core.php";
$query = new Query($pdo_link, "SELECT 2+2");
print_r($query->exec() == true);
$query->query = "CREATE TEMPORARY TABLE potatos (ID int PRIMARY KEY AUTO_INCREMENT, name varchar(20))";
print_r($query->exec() == true);
$testing = ['Juana', 'Maria', 'Pablo'];
$query->query = "INSERT INTO potatos (name) VALUES (?)";
foreach ($testing as $name) {
    print_r($query->exec([$name]) == true);
}
$query->query = "SELECT * FROM potatos";
print_r($query->exec() == true);
while ($row = $query->fetch()) {
    print_r(is_array($row) == true);
}
/*Output should look like this: 111111111*/
开发者ID:hrn4n,项目名称:argon,代码行数:21,代码来源:sql.php

示例7: function

Route::get('bookz/(:num)', function ($id) use($posts_page) {
    $Q = new Query('bookz_record');
    $Q->where('id', '=', $id);
    if (!user_authed()) {
        $Q->where('is_published', '=', 1);
    }
    if (!($record = $Q->fetch())) {
        return Response::create(new Template('404'), 404);
    }
    if (!empty($record->id_parent)) {
        $QP = new Query('bookz_record');
        $QP->where('id', '=', $record->id_parent);
        if (!user_authed()) {
            $QP->where('is_published', '=', 1);
        }
        $record->parent = $QP->fetch();
    }
    $QCh = new Query('bookz_record');
    $QCh->where('id_parent', '=', $record->id);
    if (!user_authed()) {
        $QCh->where('is_published', '=', 1);
    }
    $QCh->sort('ordkey', 'ASC');
    $QCh->sort('title', 'ASC');
    $record->child = $QCh->get();
    $posts_page->title = $record->title;
    Registry::set('page', $posts_page);
    Registry::set('record', $record);
    return new Template('bookz_record');
});
/**
开发者ID:svita-cz,项目名称:web,代码行数:31,代码来源:site.php


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