Tags
PHP , MySQL , PDO
Asked 7 years ago
10 Feb 2017
Views 1385
pratik

pratik posted

PHP :: what use of fetch_style and fetch_argument parameter in PDO

PHP :: what use of fetch_style and fetch_argument parameter in PDO
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

PDOStatement::fetchAll ([ int $fetch_style [, mixed $fetch_argument [, array $ctor_args = array() ]]] )

here fetch_style and fetch_argument control the output of fetchAll function

fetch_style ::
value can be PDO::FETCH_COLUMN , PDO::FETCH_CLASS , PDO::FETCH_FUNC

fetch_argument ::
this argument will be passed as per fetch_style ,
suppose fetch_style is PDO::FETCH_COLUMN than fetch_argument should be integer , howmuch column you want to fetch
and if fetch_style is PDO::FETCH_CLASS than fetch_argument should be class name ,
and if fetch_style is PDO::FETCH_FUNC than fetch_argument should be function name.


Post Answer