hello, according to [url]http://php.net/manual/en/pdostatement.fetchcolumn.php
[code]
<?php
$sth = $dbh->prepare(“SELECT name, colour FROM fruit”);
$sth->execute();
print(“Fetch the first column from the first row in the result set:n”);
$result = $sth->fetchColumn();
print(“name = $resultn”);
print(“Fetch the second column from the second row in the result set:n”);
$result = $sth->fetchColumn(1);
print(“colour = $resultn”);
?>
I tried to do the same
[code]
$sth = $conn->prepare(“SELECT col_1, col_2 FROM my_tb”);
$sth->execute();
print(“Fetch the first column from the first row in the result set:n”);
$result = $sth->fetchColumn();
print(“col_1 = $resultn”);
print(“Fetch the second column from the second row in the result set:n”);
$result = $sth->fetchColumn(1);
print(“col_2 = $resultn”);
Somehow, only the first column col_1 shows up. Did I do something wrong?