What's the difference between
$PDOStatement->fetchColumn();
and
$PDOStatement->fetch(PDO::FETCH_COLUMN);
(if one exists)? Or are they functionally similar but only aesthetically different?
What's the difference between
$PDOStatement->fetchColumn();
and
$PDOStatement->fetch(PDO::FETCH_COLUMN);
(if one exists)? Or are they functionally similar but only aesthetically different?
By default fetchColumn() will return only 'value' while other by default will return array('column_name'=>'value'). You'd have to use setFetchMode() to change that.
$PDOStatement->fetchColumn($colno);
would be equivalent to:
$PDOStatement->setFetchMode(PDO::FETCH_COLUMN, $colno);
$PDOStatement->fetch();