for($f=1;$f<count($stud_array)+1;$f++) { for($t=1;$t<count($work_array)+1;$t++) { $pos=mysql_query("select `дата` from `посещения` where `фио_студента`='$stud_array[$f]' and `группа`='$gg' and `дисциплина`='$dd' and `имя_работы`='$work_array[$t]' "); $number_date = mysql_fetch_array($pos); $all_date = array();$s = 1; do { echo $number_date['дата']; $all_date[$s]=$number_date['дата']; $s++; }while ($number_date = mysql_fetch_array($pos));}} print_r($all_date); 

echo $number_date['дата']; displays all dates ....

2013-06-162013-06-062013-06-122013-06-192013-06-212013-06-072013-06-122013-06-012013-06-062013-06-162013-06-062013-06-122013- 06-192013-06-212013-06-072013-06-122013-06-012013-06-062013-06-162013-06-062013-06-122013-06-192013-06-212013-06-072013-06- 122013-06-012013-06-06

However, the array output is not complete.

 print_r($all_date); Array ( [1] => 2013-06-06 ) 

2 answers 2

 $all_date = array(); $s = 1; 

It is required to declare these variables BEFORE the beginning of the declaration of for loops.

    I didn't understand anything either, but maybe it should be

     for($f=0;$f<count($stud_array);$f++) 

    etc. :)