Excerpt |
---|
PDO provides a method to get database field name (column name) from the query result. |
Below and below code shows the example:
Code Block | ||
---|---|---|
| ||
$p = new PDO( "mysql:host=localhost;dbname=foo;charset=utf8", "chun", "kang"); $select = $p->query("select * from test_table"); $fieldname = $select->fetch(PDO::FETCH_ASSOC); |
...