I want to put the results of an sql query in a two-dimensional array. The table would be something like id - > 1 name - > pepe last- > Garcia and other fields ... and I want you to put it in a two-dimensional array array [index] ['same name as the field in the table']. I have managed to do it as it comes down but there are too many fields to put them by hand and, besides, I'm sure there must be another way.
<?php
include "conexion.php";
$consulta="SELECT * FROM 'tabla' WHERE nombre like 'Juan';";
$resultado=$conexion->query($consulta) or die("No puedo realizar la consulta");
$i=0;
while ($array=$resultado->fetch_array()){
$arrayauxliar[$i]['id']=$array['id'];
$arrayauxliar[$i]['nombre']=$array['nombre'];
/*aqui vendrían un churro de campos*/
$i++;
}