©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
(PHP 5 >= 5.3.0)
SQLite3Result::columnName — Returns the name of the nth column
$column_number
)
Returns the name of the column specified by the
column_number
.
column_number
The numeric zero-based index of the column.
Returns the string name of the column identified by
column_number
.
[#1] david dot barkman13 at gmail dot com [2010-04-16 14:23:27]
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();
}
?>