本文整理汇总了PHP中resource::fetch_array方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::fetch_array方法的具体用法?PHP resource::fetch_array怎么用?PHP resource::fetch_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resource
的用法示例。
在下文中一共展示了resource::fetch_array方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
/**
* fetch one row
*
* you can provide one of the PDB::* constants to set the type
* PDB::FETCH_BOTH
* PDB::FETCH_ASSOC
* PDB::FETCH_NUM
* PDB::FETCH_OBJ
*
* @param mixed $style
* @return mixed
*/
public function fetch($style = false)
{
if (!$this->result) {
return false;
}
switch ($style) {
case PDB::FETCH_BOTH:
default:
$res = $this->result->fetch_array(MYSQL_BOTH);
break;
case PDB::FETCH_ASSOC:
$res = $this->result->fetch_array(MYSQL_ASSOC);
break;
case PDB::FETCH_NUM:
$res = $this->result->fetch_array(MYSQL_NUM);
break;
case PDB::FETCH_OBJ:
$res = $this->result->fetch_object();
break;
}
if ($res) {
$this->pos++;
}
return $res;
}
示例2: getArray
/**
* return array of result
*
* @access public
* @param string $type
*/
function getArray($type = '')
{
if (is_resource($this->connId->resId) || is_object($this->connId->resId)) {
$tabOut = array();
while ($row = $this->connId->fetch_array(null, $type == '' ? SQLITE_ASSOC : $type)) {
$tabOut[] = $row;
}
return $tabOut;
} else {
return false;
}
}
示例3: nextRecord
/**
* Get the nextRecord from the query.
* @param string $result_type
* @return resource
*/
public function nextRecord($result_type = "both")
{
if (!$this->query_id) {
$this->halt("next_record() called with no pending query.");
return false;
}
if ($this->db_type == "mysqli") {
switch ($result_type) {
case "assoc":
$this->record = $this->query_id->fetch_assoc();
break;
case "num":
$this->record = $this->query_id->fetch_fetch_row();
break;
case "both":
$this->record = $this->query_id->fetch_array();
break;
}
} else {
if ($this->db_type == "mysql") {
switch ($result_type) {
case "assoc":
$this->record = mysql_fetch_assoc($this->query_id);
break;
case "num":
$this->record = mysql_fetch_row($this->query_id);
break;
case "both":
$this->record = mysql_fetch_array($this->query_id);
break;
}
}
}
if ($this->db_type == "mysqli") {
$this->errno = $this->link_id->errno;
$this->error = $this->link_id->error;
} else {
if ($this->db_type == "mysql") {
$this->errno = mysql_errno($this->link_id);
$this->error = mysql_error($this->link_id);
}
}
$status = is_array($this->record);
if (!$status && $this->auto_free) {
$this->freeResult();
}
return $status;
}
示例4: explode
/**
* Return an array with the data to send
*
* @access private
* @return array
*/
function _getRecord()
{
if (isset($GLOBALS['TableListImpact'])) {
$tableList = explode(',', $GLOBALS['TableListImpact']);
if (count($tableList) > 1) {
$withTableName = true;
} else {
$withTableName = false;
}
foreach ($tableList as $tableImpact) {
if (!empty($tableImpact) && !preg_match('#\\.#', $tableImpact)) {
$tempInfoTable = $this->SQLiteConnId->array_query('PRAGMA table_info(' . brackets(trim($tableImpact)) . ');');
if (is_array($tempInfoTable)) {
foreach ($tempInfoTable as $infoTable) {
if ($withTableName) {
$this->NullInfo[trim($tableImpact) . '.' . $infoTable['name']] = $infoTable['notnull'];
} else {
$this->NullInfo[$infoTable['name']] = $infoTable['notnull'];
}
}
}
}
}
}
if (strpos(trim($this->order), ' ')) {
$order = '"' . $this->order . '"';
} else {
$order = $this->order;
}
$query = $this->query . ($this->order ? ' ORDER BY ' . $order . ' ' . $this->orderSens : '');
if (!preg_match('#pragma#i', $this->query) && !preg_match('#limit#i', $this->query)) {
$query .= ' LIMIT ' . $this->indexStart . ', ' . $this->recordPerPage;
}
if ($this->SQLiteConnId->query($query)) {
unset($tabRecord);
$tabRecord = array();
while ($ligne = $this->SQLiteConnId->fetch_array(null, SQLITE_NUM)) {
$tabRecord[] = $ligne;
}
}
$this->realQuery = $query;
return $tabRecord;
}
示例5:
/**
* Get one row data as associate array from resultset.
*
* @param resource $query
* The result resource that is being evaluated. This result comes from a call to mysql_query().
* @param int[optional] $result_type
* The type of array that is to be fetched. It's a constant and can take the following values: MYSQLI_ASSOC, MYSQLI_NUM, and MYSQLI_BOTH.
* @return array
* One row data in $query, or FALSE if there are no more rows
*/
function fetch_array($query, $result_type = MYSQLI_ASSOC)
{
if ($query instanceof mysqli_result) {
return $query->fetch_array($result_type);
}
return FALSE;
}
示例6: fetch
/**
* Fetch a result row as an associative, a numeric array, or both.
*
* Returns an array of strings that corresponds to the fetched row or NULL
* if there are no more rows in resultset.
*
* @param object|resource $result
* A result returned by self::query();
* @param int $resultType
* This optional parameter is a constant indicating what type of array
* should be produced from the current row data. The possible values
* for this parameter are the constants MYSQL_ASSOC, MYSQL_NUM, or
* MYSQL_BOTH.
*
* @return array|null
*/
public function fetch($result, $resultType = null)
{
return $result->fetch_array($resultType);
}
示例7: fetch
/**
* Fetch a result row as an associative, a numeric array, or both.
*
* Returns an array of strings that corresponds to the fetched row or NULL
* if there are no more rows in resultset.
*
* @param object|resource $result
* A result returned by self::query();
* @param int $resultType
* This optional parameter is a constant indicating what type of array
* should be produced from the current row data. The possible values
* for this parameter are the constants MYSQL_ASSOC, MYSQL_NUM, or
* MYSQL_BOTH.
*
* @return array|null
*/
public function fetch($result, $resultType = MYSQLI_BOTH)
{
return $result->fetch_array($resultType);
}
示例8: fetch
/**
* 获取结果集
* @return array
*/
protected function fetch()
{
return $this->rs->fetch_array($this->fetch_mode);
}