All pastes #73269 Raw Edit

Anonymous

public text v1 · immutable
#73269 ·published 2006-06-27 17:34 UTC
rendered paste body



//uitgaande dat : $arrAll_villas - alle villa's zijn


foreach($arrAll_villas as $ids){
$arrAll_ids = $ids[1];
}


// $arrAll_ids heeft nu de voorkomende id's
// hierin gooien we alles weg wat niet uniek is
// dus 1,1,3,3,3 moet alleen 1,3 van over blijven

$arrAll_unique_ids = array_unique($arrAll_ids);


// nu gaan we deze id's gebruiken om in de
// db resultaten van net de data te sorteren

$output = '';


foreach($arrAll_unique_ids as $key=>$table_villa){

 
     $tdrow = '';
     $villaname = '';

   
     $villaname = $arrAll_villas[$key][0];
     
     for($i=1;$i<=52;$i++){

            

            if(!empty($arrAll_villas[$key][3])){
                 $tdrow .= '<td>'.$arrAll_villas[$key][0].'</td>';
                 }
                 else {
                 $tdrow .= '<td></td>';
                 }


            }
         

     
     $output .= '<table>';
     $output .= '<tr><td colspan="20">'.$villaname.'</td></tr>';
     $output .= '<tr>'.$tdrow.'</tr>';
     $output .= '</table><br><br>';

}


echo $output;







Array
(
    [0] => Array
        (
            [0] => Villa Hortensias
            [1] => 1
            [2] => 1
            [3] => 5
        )

    [1] => Array
        (
            [0] => Villa Hortensias
            [1] => 1
            [2] => 1
            [3] => 42
        )

    [2] => Array
        (
            [0] => Villa Costa
            [1] => 3
            [2] => 1
            [3] => 8
        )

    [3] => Array
        (
            [0] => Villa Costa
            [1] => 3
            [2] => 1
            [3] => 12
        )

    [4] => Array
        (
            [0] => Villa Costa
            [1] => 3
            [2] => 1
            [3] => 20
        )

    [5] => Array
        (
            [0] => Villa Costa
            [1] => 3
            [2] => 1
            [3] => 51
        )

)
<pre>1</pre>