How to get rid of the duplication of output values of the query PDO::query()?

Good afternoon. I learn stack PHP and MariaDB. Have the following code accessing the database:
$db = new PDO('mysql:host=localhost;dbname=taxi', 'root', '123');
$sql = 'SELECT * FROM autos WHERE id = 1';
$result = $db->query($sql);
$arr = $result->fetch();
var_dump($arr);

var_dump returns the following:
5a3185b89dc5f656507347.png
As you can see, each underlined string duplicate values as the previous one but with continuous indexing. Is it possible somehow to get rid of it?
June 10th 19 at 15:25
2 answers
June 10th 19 at 15:27
Solution
$result = $db->query($sql, PDO::FETCH_ASSOC);
Thank you very much:) - maxie_Herm commented on June 10th 19 at 15:30
June 10th 19 at 15:29
you just have to use shims under mysql
an alarm that su perelegans.
and advise your mysqli-crutch to the question about PDO is five. - maxie_Herm commented on June 10th 19 at 15:32
PDO is a raw buggy crap
we have said - kavon.Murphy commented on June 10th 19 at 15:35
why this is necessary when there is PDO? And in the era of Eloquent/Doctrine/Propel/Analogue/Aura/etc... - micheal commented on June 10th 19 at 15:38
not to be confused with the ORM (i.e., doctrine) and the layer for work with DB. This layer exists nowhere. He always needed.

why do it when there is PDO?
then, that PDO is a wildly raw and curve thing, absolutely not fitted for normal operation.

https://habrahabr.ru/post/148701/ - Cecelia78 commented on June 10th 19 at 15:41
not to be confused with the ORM (i.e., doctrine) and the layer for work with DB. This layer exists nowhere. He always needed.


interesting , but the comments you have read or just saw a few words?

then, that PDO is a wildly raw and curve thing, absolutely not fitted for normal operation.

I suggest to read all the comments and the article? No, thank you. I remember 5 years ago there was a similar report on DevConf, treshak another one, I think it was called "final protection against sql injection". The author of reinvent the wheel, confusing "?" from PDO to format the query with quoting and thought it feil. Then I see about the same thing - attempting a super-crutch is not clear why. - micheal commented on June 10th 19 at 15:44
,
PDO is a raw buggy crap
we have said
not us, dude, and you.
and the argument you topics 5/6 years ago, which rotted long ago.
and even the fact that the same right there on the toaster shit conceals mysqli does not break through your die-hards. - Cecelia78 commented on June 10th 19 at 15:47
, thought can't cover shit. mysqli is the adapter a "low" level. from what you have covered, it is not warm, not cold - this adapter is based on ALL. - kavon.Murphy commented on June 10th 19 at 15:50
this adapter is based on ALL only in your fevered imagination. however as its "low" level (used all the same libmysql/mysqlnd).
and cut the crap can be anything, if there are arguments (Sori, but the constant reference to rancid articles authored by a man who drowns himself for PDO - not an argument).

in mysqli there is only one feature which is not very popular - asynchronous requests. in all other respects it sucks the PDO to swallow. - micheal commented on June 10th 19 at 15:53
Yes use PDO, I was what.. opinions own you and there was not. - kavon.Murphy commented on June 10th 19 at 15:56
talking to you will when maps links to venatovskiy topics to give, and to roll out a list of items mysqli is better than pdo.
a about opinion you can authoritatively push pimply shkolote. - micheal commented on June 10th 19 at 15:59
never universal may not be better than private
is that enough?
and anyway, where does the mysqli extension?
I'm talking about the wrapper. that mysqli and pdo in its current form is SHIT, where to write the native is not convenient. what else matters? - kavon.Murphy commented on June 10th 19 at 16:02
,
never universal may not be better than private
this is enough
lolshto?
this is not an argument, and the next bubble from the series "Armenians are better than Georgians. and what is better? well than Georgians".
be able to describe at least a few points on which a pdo mysqli wins, then we'll talk.

I'm talking about the wrapper. that mysqli and pdo in its current form is SHIT, where to write the native is not convenient. what else matters?
the question is, what if you do not use mysqli-specific thing, as asynchronism or multispray, it does not remain any reason to use it. even with the wrapper, though without.
your wrapper perfectly realized using PDO, and wrapper code and the client code is reduced at least 1.5 times.
but "PDO -crude buggy crap", Yes. - micheal commented on June 10th 19 at 16:05

Find more questions by tags PHPMariaDB