Looped -Prozess zeigt nur das erste Ergebnis pro Iteration [Duplikat]Php

PHP-Programmierer chatten hier
Anonymous
 Looped -Prozess zeigt nur das erste Ergebnis pro Iteration [Duplikat]

Post by Anonymous »

In meiner Codesigniter-Anwendung erhalte ich eine Reihe von Zulassungsnummer der Schüler, die eingecheckt werden sollte.

Code: Select all

array(5) {
[0]=> string(5) "11784"
[1]=> string(5) "11837"
[2]=> string(5) "11775"
[3]=> string(5) "11937"
[4]=> string(5) "12061"
}
< /code>
Ich versuche, die Datenbank mit diesen Zahlen abzufragen, aber das Ergebnis zeigt nur das erste Schülerergebnis.foreach ($ad_no as $key => $id) {
$this->db->where_in('ad_no', $id);
$query = $this->db->get('duration');
$r = $query->result_array();

$dur = $r[0]['tot_hr'];
$start = explode(':', $dur);
$end = explode(':', $tm);
$total_hours = $start[0] - $end[0];
$total_hours1 = $start[1] - $end[1];
$mins = abs($total_hours1);
$dur = $total_hours . ":" . $mins;
$durs[$key] = array(
'ad_no' => $ad_no[$key],
'tot_hr' => $dur
);
}
$reslt = $this->Daily_temp_model->duration($durs);

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post