Answer the question
In order to leave comments, you need to log in
How to get from the database (mysqli) all records in the form of associative arrays?
There is a database:
id, foo, bar
1,1,1
2,2,2
I want to get an array:
[0]=>['id'=>1,'foo'=>1,'bar'=>1]
[ 1]=>['id'=>2,'foo'=>2,'bar'=>2]
mysqli_fetch_all returns non-associative arrays. I can't find a suitable method.
Answer the question
In order to leave comments, you need to log in
mysqli_fetch_all($res, MYSQLI_ASSOC);
php.net/manual/ru/mysqli-result.fetch-all.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question