Getting first element from PDOStatement
I am performing an sql query using PDO. In the resulting PDOStatement, there is only one column. If i use PDOStatement->fetch(); would it serve my purpose?
Yes, although fetchColumn() would probably be more convenient as the return value will be scalar.
otherwise you could do the following, or many variations of
$row = $stmt->fetch(PDO::FETCH_NUM); echo $row;