本文整理汇总了PHP中adodb_getall函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_getall函数的具体用法?PHP adodb_getall怎么用?PHP adodb_getall使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adodb_getall函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dl
<?php
dl('adodb.so');
include_once 'phplens/adodb/adodb.inc.php';
$db = ADONewConnection('mysql');
$server = 'jaguar';
$user = 'mobydick';
$password = $_GET['pwd'];
$database = 'northwind';
$db->Connect($server, $user, $pwd, $database);
$rs = $db->Execute('select productname,unitsinstock from products');
while (!$rs->EOF) {
print_r($rs->fields);
print HTML_BR;
adodb_movenext($rs);
## ADODB extension function
}
$rs->Close();
echo '<hr/>';
$rs = $db->Execute("select productname, unitsinstock from products where productid < 5");
$arr = adodb_getall($rs);
## ADOdb extension function
echo '<pre>';
print_r($arr);
echo '</pre>';
示例2: adodb_getall
/**
* return recordset as a 2-dimensional array.
*
* @param [nRows] is the number of rows to return. -1 means every row.
*
* @return an array indexed by the rows (0-based) from the recordset
*/
function &GetArray($nRows = -1)
{
global $ADODB_EXTENSION;
if ($ADODB_EXTENSION) {
$results = adodb_getall($this, $nRows);
return $results;
}
$results = array();
$cnt = 0;
while (!$this->EOF && $nRows != $cnt) {
$results[] = $this->fields;
$this->MoveNext();
$cnt++;
}
return $results;
}
示例3: GetArray
/**
* return recordset as a 2-dimensional array.
*
* @param [nRows] is the number of rows to return. -1 means every row.
*
* @return an array indexed by the rows (0-based) from the recordset
*/
function GetArray($nRows = -1)
{
global $ADODB_EXTENSION;
if ($ADODB_EXTENSION) {
$results = adodb_getall($this, $nRows);
return $results;
}
$results = array();
$cnt = 0;
while (!$this->EOF && $nRows != $cnt) {
// $results[] = $this->fields;
$rs = $this->fields;
$keys = array_keys($rs);
$new_rs = null;
foreach ($keys as $key) {
$new_rs[strtolower($key)] = $rs[$key];
}
$results[] = $new_rs;
$this->MoveNext();
$cnt++;
}
return $results;
}