Handle records in a php array

0

I have a query in the database that returns the records in an array, I would like to know how to manipulate these records, get them out of the array.

Code

$array = MinPDO::consult("intro", NULL, "id > 1", "id-", "3", "%e%");

var_dump($array);

Records

array(3) { [0]=> array(3) { ["id"]=> int(3) ["param1"]=> string(5) "ele01" ["param2"]=> string(6) "param2" } [1]=> array(3) { ["id"]=> int(2) ["param1"]=> string(5) "ele01" ["param2"]=> string(6) "param2" } [2]=> array(3) { ["id"]=> int(1) ["param1"]=> string(5) "ele01" ["param2"]=> string(6) "param2" } } 
    
asked by anonymous 15.08.2016 / 15:20

1 answer

1
  

You can use foreach for this follows an example

foreach($array as $info) {
    echo $info['id']." - ".$info['param2']."<br/>";
}
  

Foreach is also better

for($i = 0; $i < count($array); $i++) {
    echo $array[$i]['id']." - ".$array[$i]['param2']."<br/>";
}
    
15.08.2016 / 16:31