2013-06-22 32 views
0

我試圖合併表中的細胞,我想它看起來像的SQLPlus功能「上欄符」,但我不知道如何做到這一點。合併單元格內容相同的HTML

例子:

|monday | refrref | 
|monday | referfr | 

|monday | refrref | 
|  | referfr | 

感謝

+0

請分享迄今爲止所做的工作。 – Robbert

+0

什麼都沒有,我只把我的MySQL查詢放在表中,就像​​DAY​​TEXT – JeanneD4RK

回答

0

釘它

使用一個PHP類來做到這一點。對不起,法語變數名稱

class jours { 
    var $jour; 
    var $horaire; 
    var $nbr=0; 
} 

$lundi = new jours(); 
$mardi = new jours(); 
$mercredi = new jours(); 
$jeudi = new jours(); 
$vendredi = new jours(); 

$lundi->jour = "Lundi"; 
$mardi->jour = "Mardi"; 
$mercredi->jour = "Mercredi"; 
$jeudi->jour = "Jeudi"; 
$vendredi->jour = "Vendredi"; 

// rest of the code, queries 

switch ($infos['jour']){ 
    case 'Lundi': 
     $lundi->horaire[$lundi->nbr] = $infos['horaire']; 
     $lundi->nbr++; 
     break; 
    case 'Mardi': 
     $mardi->horaire[$mardi->nbr] = $infos['horaire']; 
     $mardi->nbr++; 
     break; 
    case 'Mercredi': 
     $mercredi->horaire[$mercredi->nbr] = $infos['horaire']; 
     $mercredi->nbr++; 
     break; 
    case 'Jeudi': 
     $jeudi->horaire[$jeudi->nbr] = $infos['horaire']; 
     $jeudi->nbr++; 
     break; 
    case 'Vendredi': 
     $vendredi->horaire[$vendredi->nbr] = $infos['horaire']; 
     $vendredi->nbr++; 
     break; 
} 



// display the table 

$affichage = array($lundi,$mardi,$mercredi,$jeudi,$vendredi); //used this array to be able to make the for loop later 
echo '<table>'; 
for($i=0;$i<5;$i++){ 
    if($affichage[$i]->nbr != 0){ 
     echo '<tr><td>'; //1st line 1st column 
     echo $affichage[$i]->jour; 
     echo '</td><td>'; //1st line 2nd column 
     echo $affichage[$i]->horaire['0']; 
     echo '</td></tr>'; 
     for($j=1; $j < $affichage[$i]->nbr; $j++){ //other lines and columns 
      echo '<tr><td></td><td>'; 
      echo $affichage[$i]->horaire[$j]; 
      echo '</td></tr>'; 
     } 
    } 
} 
echo '</table>'; 
相關問題