本文整理汇总了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;
}
示例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;
}
}
示例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;
}
}
示例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();
}
示例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;
}
}
示例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*/
示例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');
});
/**