IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Dimensionnement dynamique de tableaux


Sujet :

Langage PHP

  1. #1
    Membre éclairé Avatar de rems033
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    513
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Mai 2007
    Messages : 513
    Par défaut Dimensionnement dynamique de tableaux
    Salut à tous...
    Je reviens vers vous car j'ai un souci de compatibilité entre IE et FF au niveau de la génération dynamique d'un tableau.
    Je vous laisse 2 screenshots pour visualiser le probleme.
    Il se trouve au niveau des colonnes de chaque stations (V,H1, H2) pour chaque tir.
    Je ne comprends d'ou peut provenir l'erreur car pour la ligne de description, le dimmensionnement est impécable alors que lors de la génération dynamique, j'ai un décalage sous FF et pas sous IE.

    Merci bcp pour votre aide !

    Voici le code (un peu long je sais)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
     
    <?php
     session_cache_limiter('private'); /* Configure le limiteur de cache à 'private' */
     $cache_limiter = session_cache_limiter(); 
     session_cache_expire (30);  /* Configure le délai d'expiration à 30 minutes */
     $cache_expire = session_cache_expire();  
     session_start();  /* Démarre la session */
     
     require('../scripts/connexion.php');
     $connexion = mysql_connect($hostname, $username, $password) or die("Connexion impossible au serveur $hostname par $username");
     mysql_select_db($database, $connexion);   
     // On recherche le nombre d'evenements associé au site courant
     $sql = "SELECT * FROM event WHERE id_site = '".$_SESSION['id_site']."' AND event_is_valid='1' ORDER BY id_tir DESC";
     $req = mysql_query($sql) or die(mysql_error());
     
     $event = mysql_fetch_array($req);
     
     $current_tir = $event['id_tir'] ;
     $nb_tirs_total = 1 ;
     $inc = 1;
     
     // On recherche le nombre de tirs differents
     while($event = mysql_fetch_array($req))
     {
      if($event['id_tir']!=$current_tir)
      {
       $nb_tirs_total++ ;
       $current_tir = $event['id_tir'] ;
      }
     }
    ?>
    <table width="89%" border="1" align="center" class="event"  cellpadding="0" cellspacing="0">
        <tr align="center">
         <td width="15%" bgcolor="#E7F0FE">Tir</td>
            <td width="20%" bgcolor="#E7F0FE">Caract.</td> 
        <?php
         $nb_network = get_nb_network($_SESSION['id_site']);
      $width_entete = 50/$nb_network."%" ;
      $width = 25/$nb_network."%" ;
      echo $width_entete ;
      for( $inc=1 ; $inc <= $nb_network ; $inc++ )
      {
       ?>
       <td  width="<?php echo $width; ?>" bgcolor="#E7F0FE"> 
                 <table width="100%">  
                     <tr>
                         <th colspan="2">
                            <?php
          $sql = "SELECT * FROM network WHERE id_network = '".$inc."'";
          $req = mysql_query($sql) or die(mysql_error());
     
          $network = mysql_fetch_array($req);
     
          echo $network['network_name']."<br />".$network['network_desc'] ;
          ?>
                            </th>
                        </tr>  
                        <tr>       
                            <td width="<?php echo $width; ?>" bgcolor="#E7F0FE" align="center">Vitesse Particulaire max. mm/s</td>
                            <td width="<?php echo $width; ?>" bgcolor="#E7F0FE" align="center">Fr&eacute;quence dominante en Hz</td>
                        </tr>
                    </table>
                </td>
       <?php
      }
        ?>
         <td width="15%" bgcolor="#E7F0FE">Actions</td>  
        </tr>
        <tr>
         <td width="20%" bgcolor="#C4DBFD">
             <table width="100%" class="event_interieur">
                    <tr align="center">
                        <td width="10%">Tir</td>
                        <td width="50%">Date</td>
                        <td width="40%">Heure</td>
                    </tr>
                </table>
      </td>
            <td width="20%" bgcolor="#C4DBFD">
             <table width="100%" class="event_interieur">
                    <tr align="center">
                        <td width="20%">Mode</td>
                        <td width="20%">nb Trou</td>
                        <td width="20%">Q inst.</td>
                        <td width="20%">Q unit.</td>
                        <td width="20%">Q spec.</td>
                    </tr>
                </table>
            </td>
             <?php
       $nb_network = get_nb_network($_SESSION['id_site']);
       $width = 25/$nb_network."%" ;
       for( $inc=1 ; $inc <= $nb_network ; $inc++ )
       {
        ?>
                    <td  width="<?php echo $width; ?>" bgcolor="#C4DBFD"> 
                        <table width="100%" bgcolor="#C4DBFD">  
                            <tr>   
                                <td width="<?php echo $width; ?>">
                                    <table width="100%" class="event_interieur" bgcolor="#C4DBFD">
                                        <tr align="center">
                                            <td width="33%">V</td>
                                            <td width="33%">H1</td>
                                            <td width="33%">H2</td>
                                        </tr>
                                    </table>
                                </td>
                                <td width="<?php echo $width; ?>">
                                    <table width="100%" class="event_interieur" bgcolor="#C4DBFD">
                                        <tr align="center">
                                            <td width="33%">V</td>
                                            <td width="33%">H1</td>
                                            <td width="33%">H2</td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
        <?php
       }
      ?> 
            <td width="10%" bgcolor="#C4DBFD">
     
            </td>  
        </tr>
        <?php
     require('../scripts/connexion.php');
     $connexion = mysql_connect($hostname, $username, $password) or die("Connexion impossible au serveur $hostname par $username");
     mysql_select_db($database, $connexion);
     
     if($nb_tirs_total <= 5)
     {
      $nb_tirs = $nb_tirs_total ;
     } 
     else
     {
      $nb_tirs = 5 ;
     }  
     // On affiche une ligne par tirs
     for($i=$nb_tirs_total ; $i > ($nb_tirs_total-$nb_tirs) ; $i-- )
     {
      // On recherche le nombre d'evenements associé au site courant
      $sql = "SELECT * FROM event WHERE id_site = '".$_SESSION['id_site']."' AND event_is_valid='1' AND id_tir = '".$i."'";
      $req = mysql_query($sql) or die(mysql_error()); 
      $event = mysql_fetch_array($req);  
      ?>
      <tr bgcolor="#FFFFFF">
       <td width="20%">
        <table width="100%" class="event_interieur2">
         <tr align="center">
          <td width="10%"><?php echo $event['id_tir']; ?></td>
          <td width="50%"><?php echo $event['event_date']; ?></td>
          <td width="40%"><?php echo $event['event_time']; ?></td>
         </tr>
        </table>
       </td>
                <?php
        $res = "SELECT * FROM tirs WHERE id_tir = '".$event['id_tir']."'";
        $sub = mysql_query($res) or die(mysql_error()); 
     
        $tir = mysql_fetch_array($sub)
       ?>
       <td width="20%">
        <table width="100%" class="event_interieur2">
         <tr align="center">
          <td width="20%"><?php echo $tir['mode']; ?></td>
          <td width="20%"><?php echo $tir['nb_trou']; ?></td>
          <td width="20%"><?php echo $tir['Q_inst']; ?></td>
          <td width="20%"><?php echo $tir['Q_unit']; ?></td>
          <td width="20%"><?php echo $tir['Q_spec']; ?></td>
         </tr>
        </table>
       </td>
        <?php
        $nb_network = get_nb_network($_SESSION['id_site']);
        $width = 25/$nb_network."%" ;
        for( $inc=1 ; $inc <= $nb_network ; $inc++ )
        {
         ?>
                        <td  width="<?php echo $width_entete; ?>"> 
                            <table>  
                                <tr align="center">
                                    <td width="<?php echo $width; ?>" align="center">
                                        <table width="100%" class="event_interieur2" align="center" border="1">
                                            <tr align="center" width="50%">
                                            <?php
                                                $res = "SELECT * FROM event WHERE id_site = '".$_SESSION['id_site']."' AND event_is_valid='1' AND id_tir = '".$i."' AND id_network = '".$inc."'";
                                                $sub = mysql_query($res) or die(mysql_error()); 
     
                                                while($event = mysql_fetch_array($sub))
                                                {
                                                ?>
                                                    <td align="center"><?php echo $event['event_value']; ?></td>
                                                <?php
                                                }
                                                ?>
                                            </tr>
                                        </table>
                                    </td>
                                    <td width="<?php echo $width; ?>" align="center">
                                        <table width="100%" class="event_interieur2" align="center" border="1">
                                            <tr align="center">
                                                <?php
                                                $res = "SELECT * FROM event WHERE id_site = '".$_SESSION['id_site']."' AND event_is_valid='1' AND id_tir = '".$i."' AND id_network = '".$inc."'";
                                                $sub = mysql_query($res) or die(mysql_error()); 
     
                                                while($event = mysql_fetch_array($sub))
                                                {
                                                ?>
                                                    <td width="33%" align="center"><?php echo $event['event_frq']; ?></td>
                                                <?php
                                                }
                                                ?>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
         <?php
        }
       ?> 
       <td width="10%">
       <table width="100%" border="0" class="event_interieur2">
                    <tr align="center" valign="middle">
                        <td width="20%">&nbsp;</td>
                        <td width="20%"><img src="../images/loupe.png" class="transparent"></td>
                        <td width="20%">&nbsp;</td>
                        <td width="20%"><img src="../images/acroread.png" class="transparent"></td>
                        <td width="20%">&nbsp;</td>
                    </tr>
                </table>
       </td>  
      </tr>
        <?php
     }
     ?>
    </table>
    Images attachées Images attachées   

  2. #2
    Expert confirmé
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 350
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 350
    Billets dans le blog
    17
    Par défaut
    1. Je vois un width dans un <tr> : bof.
    2. Pourquoi utiliser des <table> dans tes <td> ? Cela ne m'a pas l'air correct, sémantiquement parlant. Un unique <table> suffirait.
    3. Cela concerne davantage le HML/CSS que PHP

Discussions similaires

  1. allocation dynamique et tableaux de pointeurs
    Par gbardy dans le forum 4D
    Réponses: 3
    Dernier message: 06/07/2006, 11h08
  2. [HTML] IFRAME Dimensionnement dynamique
    Par markeno dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 24/06/2006, 09h18
  3. Allocation et réallocation dynamique de tableaux
    Par petitmic dans le forum C++
    Réponses: 4
    Dernier message: 14/03/2006, 14h59
  4. Réponses: 3
    Dernier message: 24/02/2006, 13h27
  5. Dimensionnement dynamique d'un Tmemo
    Par fausto dans le forum C++Builder
    Réponses: 3
    Dernier message: 26/02/2004, 10h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo