How to execute store procedure in loop.

Hi Team,

I am facing one issue. Please have a look on below code.

// $data having 1000 entries

foreach($data as $key=>$value) {

$resultStore = $this->db->query("call get_parents(" . $value['id'] . ")");

$dataStore = $resultStore->fetchAll(PDO::FETCH_ASSOC);

}

But this loop execute only one time.

Please let me know if anyone have solution for this.

Thanks, Amol



31.2k

Hi,

on each loop step $resultStore and $resultStore are overwriten by te new db queries. So, you have only one result in them.