note 97381 modified in sqlite3result.columnname by danbrown
| From: | danbrown@php.net | Date: | Fri, 16 Apr 2010 21:24:36 +0000 |
| Subject: | note 97381 modified in sqlite3result.columnname by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168332@lists.php.net to get a copy of this message | ||
Example:
<?php
public function selectAll($table)
{
$results = $this->_dbConn->query("SELECT * FROM $table");
$cols = $results->numColumns();
while ($row = $results->fetchArray()) {
for ($i = 1; $i < $cols; $i++) {
echo $results->columnName($i) . ': ';
echo $row[$i] . '<br />';
}
//print_r($row);
//echo 'Username: ' . $row['USERNAME'] . '<br />';
}
$this->_dbConn->close();
}
?>
--was--
Example:
public function selectAll($table)
{
$results = $this->_dbConn->query("SELECT * FROM $table");
$cols = $results->numColumns();
while ($row = $results->fetchArray()) {
for ($i = 1; $i < $cols; $i++) {
echo $results->columnName($i) . ': ';
echo $row[$i] . '<br />';
}
//print_r($row);
//echo 'Username: ' . $row['USERNAME'] . '<br />';
}
$this->_dbConn->close();
}
http://php.net/manual/en/sqlite3result.columnname.php