Can anybody help me regarding this... My code is below :
$STH = $DBH->query('SELECT id,zone,latlng FROM `rl_zones`');
$STH->setFetchMode(PDO::FETCH_ASSOC);
while ($row = $STH->fetch()) {
// here i need column names i.e id,zone,latlng.
// i want to display those column names....
}
Thanks
IN pdo use PDO::FETCH_COLUMN
$STH = $DBH->prepare("DESCRIBE rl_zones");
$STH->execute();
$table_fields = $STH->fetchAll(PDO::FETCH_COLUMN);
print_r($table_fields);
http://php.net/manual/en/pdostatement.fetchcolumn.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With