Here is the result of my code:
$res = $stm->fetchAll();
/*
Array
(
[0] => Array
(
[name] => apple
[0] => apple
[colour] => red
[1] => red
)
[1] => Array
(
[name] => pear
[0] => pear
[colour] => green
[1] => green
)
)
And if I use fetchAll(PDO::FETCH_ASSOC)
, the result will be:
/*
Array
(
[0] => Array
(
[name] => apple
[colour] => red
)
[1] => Array
(
[name] => pear
[colour] => green
)
)
Now I want to know, how can I get this ?
/*
Array
(
[0] => Array
(
[0] => apple
[1] => red
)
[1] => Array
(
[0] => pear
[1] => green
)
)
Noted that PDO::FETCH_COLUMN
won't return the expected result.