public string | ** fetchColumn (string $sqlQuery, [array $placeholders], [int | string $column])
Returns the n’th field of first row in a SQL query result
1 2 3 4 5 6 7 | //Getting count of robots $robotsCount = $connection ->fetchColumn( "SELECT count(*) FROM robots" ); print_r( $robotsCount ); //Getting name of last edited robot $robot = $connection ->fetchColumn( "SELECT id, name FROM robots order by modified desc" , 1); print_r( $robot ); |
Please login to continue.