php - PDO::FETCH_COLUMN fetches nothing -
the following code gives me array $a
containing description
.
$stmt = $dbh->prepare("select description, id money_items"); $stmt->execute(); $a = $stmt->fetchall(pdo::fetch_column, 0); $id = $stmt->fetchall(pdo::fetch_column, 1);
but $id
array comes out blank.
array ( )
if remove $a = $stmt->fetchall(pdo::fetch_column, 0);
line, $id
array comes out fine. allowed fetch 1 column results?
what looking
$results = $stmt->fetchall(pdo::fetch_assoc);
this fetch columns , rows array -
http://wiki.hashphp.org/pdo_tutorial_for_mysql_developers
to answer actual question though, guess fetchall function called on statement runs through rows, internal pointer in array @ end when fetch second column.
Comments
Post a Comment