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

PHP & Base de données Discussion :

Fonctionne bien mais pas tout le temps


Sujet :

PHP & Base de données

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    30
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 30
    Points : 21
    Points
    21
    Par défaut Fonctionne bien mais pas tout le temps
    Bonjour à tous,
    J'aimerais avoir votre avis, votre aide sur un soucis étrange qui m'arrive :
    J'ai créé des pages en php/mysql qui vont chercher dans 6 tables d'une BDD les annonces qui s'y trouvent (recherche pas rubrique, fort simple !)
    ça fonctionne bien , mais pas tout le temps , parfois (disons 1 fois sur 8) il s'affiche une page "Impossible d'afficher la page" ... Le problème c'est que ça arrive sur n'importe quelle page à tour de rôle et il suffit de rafraîchir pour que l'affichage demandé apparaisse correctement...J'ai testé en limitant le nombre d'affichage par page, ça ne change rien .... voici le code d'une page : Merci de votre aide

    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
    <?php virtual('/Connections/annonces.php'); ?>
    <?php
    $currentPage = $_SERVER["PHP_SELF"];
     
    //jeu d'enregistrement pour la table animaux et affichage max de 4 annonces par page !
    $maxRows_animaux = 4;
    $pageNum_animaux = 0;
    if (isset($_GET['pageNum_animaux'])) {
      $pageNum_animaux = $_GET['pageNum_animaux'];
    }
    $startRow_animaux = $pageNum_animaux * $maxRows_animaux;
     
    mysql_select_db($database_annonces, $annonces);
    $query_animaux = "SELECT * FROM animaux ORDER BY espece ASC";
    $query_limit_animaux = sprintf("%s LIMIT %d, %d", $query_animaux, $startRow_animaux, $maxRows_animaux);
    $animaux = mysql_query($query_limit_animaux, $annonces) or die(mysql_error());
    $row_animaux = mysql_fetch_assoc($animaux);
     
    if (isset($_GET['totalRows_animaux'])) {
      $totalRows_animaux = $_GET['totalRows_animaux'];
    } else {
      $all_animaux = mysql_query($query_animaux);
      $totalRows_animaux = mysql_num_rows($all_animaux);
    }
    $totalPages_animaux = ceil($totalRows_animaux/$maxRows_animaux)-1;
     
    $queryString_animaux = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_animaux") == false && 
            stristr($param, "totalRows_animaux") == false) {
          array_push($newParams, $param);
        }
      }
      if (count($newParams) != 0) {
        $queryString_animaux = "&" . htmlentities(implode("&", $newParams));
      }
    }
    $queryString_animaux = sprintf("&totalRows_animaux=%d%s", $totalRows_animaux, $queryString_animaux);
    ?>
    <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <title>Lire une annonce</title>
      <script language="javascript" src="js/base.js"></script>
      <script language="javascript">getVieCaisseCss();</script>
      <link href="css/ce800.css" rel="stylesheet" type="text/css" />
     
      <style type="text/css">
    <!--
    .Style1 {color: #FFD442}
    a:link {
    	text-decoration: none;
    	color: #000000;
    }
    a:visited {
    	text-decoration: none;
    	color: #000000;
    }
    a:hover {
    	text-decoration: underline;
    }
     
    -->
      </style>
      </head>
     
    <body>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td nowrap height="60" width="384" valign="top" bgcolor="#ffffff" align="left"><script language="javascript">ImgAccueil("maire.jpg");</script></td>
        <td nowrap height="60" width="30%" align="center" valign="middle" bgcolor="#ffffff" class="CE"><div align="left"><span class="CE2">C</span>omit&eacute; d'<span class="CE2">E</span>ntreprise</div></td>
        <td nowrap height="60" width="94" align="left" bgcolor="#3366CC"><img src="img/bp3.gif" width"94" height="60" /></td>
        <td nowrap height="60" width="107" bgcolor="#3366CC" class="Espace"><script language="javascript">
    <!--
        Espace("ctri.gif")
    // -->
    </script></td></tr>
    </table>
    <!-- table du chemin -->
    <table width="100%" cellpadding="0" cellspacing="0" class="Progression">
      <tr>
        <td valign="top"><script language="javascript">Progression2("http://" + getAccueil(), "Retour &agrave; l'accueil de notre Intranet", "Accueil", "http://55.54.217.33/CEnew/index.php", "Comite d'Entreprise", "Comité d'Entreprise", "annonces.php","Les annonces","Les annonces","visuannonces.php","Lire une annonce","Lire une annonce","");</script>  
      </tr>
    </table>
     
    <!-- début tab fond de page -->
    <!-- table du corps entier -->
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><!-- table menu + boite idées + flash -->
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td bgcolor="#FF9999"><?php include "menu_deroulant.inc.php" ?></td>
              <td height="100%" rowspan="2" align = "left" valign="top"><? include "retrouveznous.inc.php";?></td>
            </tr>
            <tr>
              <td width="640" align="center" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td colspan="3" ><a href="annonces.php"><img src="img/img_new/entetesousmainannonces.png" width="640" border="0" /></a></td>
                  </tr>
                <tr>
                  <td rowspan="2" align="left" valign="top"><img src="img/img_new/barregauchejaune.png" /></td>
                  <td  rowspan="2" valign="top"><div align="center">
    			  <?php do { ?>
    			    <table width="96%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFD544">
    				  <tr>
    					<td width="15%"><?php echo '&nbsp;'.ucfirst($row_animaux['espece']); ?></td>
    					<td width="60%"><?php echo '&nbsp;'.ucfirst($row_animaux['race']); ?></td>
    					<td width="5%"><?php echo '&nbsp;'.ucfirst($row_animaux['sexe']); ?></td>
    					<td width="5%"><?php echo '&nbsp;'.$row_animaux['age']; ?></td>
    				    <td width="15%"><?php echo '&nbsp;'.strtolower($row_animaux['ans']); ?></td>
    				  </tr>
    				  <tr>
    					<td colspan="5"><?php echo '&nbsp;'.$row_animaux['libelle_animaux'] . ' contact : ' . $row_animaux['contact_animaux']; ?></td>
    					</tr>
    				</table>
     
    				<br />
    				 <?php } while ($row_animaux = mysql_fetch_assoc($animaux)); ?>
     
                    <table width="33%" border="0" align="right" cellpadding="1" cellspacing="0">
                      <tr>
                            <td align="center" valign="bottom">&nbsp;
    								<?php						  
    						  		if ($pageNum_animaux > 0) { // Show if not first page ?>
                                    <a href="<?php printf("%s?pageNum_animaux=%d%s", $currentPage, 0, $queryString_animaux); ?>"><img src="First.gif" border=0></a>
                            <?php } // Show if not first page ?>                              </td>
                                    <td align="center"><?php if ($pageNum_animaux > 0) { // Show if not first page ?>
                                      <a href="<?php printf("%s?pageNum_animaux=%d%s", $currentPage, max(0, $pageNum_animaux - 1), $queryString_animaux); ?>"><img src="Previous.gif" border=0></a>
                            <?php } // Show if not first page ?>                                </td>
                                    <td align="center"><?php if ($pageNum_animaux < $totalPages_animaux) { // Show if not last page ?>
                                      <a href="<?php printf("%s?pageNum_animaux=%d%s", $currentPage, min($totalPages_animaux, $pageNum_animaux + 1), $queryString_animaux); ?>"><img src="Next.gif" border=0></a>
                            <?php } // Show if not last page ?>                                </td>
                                    <td align="center" valign="bottom"><?php if ($pageNum_animaux < $totalPages_animaux) { // Show if not last page ?>
                                      <a href="<?php printf("%s?pageNum_animaux=%d%s", $currentPage, $totalPages_animaux, $queryString_animaux); ?>"><img src="Last.gif" border=0></a>
                            <?php } // Show if not last page ?>                          </td>
                          </tr>
                        </table>
                        </div>
    			  </td>
                  <td valign="top"><div align="right"><img src="img/img_new/barredroitejaune.png" /></div></td>
                </tr>
                <tr>
                  <td height="304" valign="top" class="boutdepied"></td>
                </tr>
                <tr>
                  <td colspan="3" ><img src="img/img_new/piedsousmainrouge.png" /></td>
                  </tr>
              </table></td>
            </tr>
    	  </table>
    	</td>
      </tr>
    </table>
    </body>
    </html>
    <?php
    mysql_free_result($animaux);
    ?>

  2. #2
    Membre régulier
    Inscrit en
    Juin 2007
    Messages
    89
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Juin 2007
    Messages : 89
    Points : 99
    Points
    99
    Par défaut
    Bonjour, pourquoi utilises tu virtual? Je ne connais pas trop cette fonction, mais pourquoi ne pas utiliser include à la place?

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    30
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 30
    Points : 21
    Points
    21
    Par défaut
    Merci pour l'idée.... je vais tester ça dès demain
    Après quelques tests, il semble que l'erreur n'apparaisse plus, j'ignore la cause du bug avec virutal(), si quelqu'un la connait, j'aimerais qu'il nous en fasse part.... Merci encore

Discussions similaires

  1. Réponses: 1
    Dernier message: 13/02/2012, 11h16
  2. jQuery erreur "Warning:" parfois mais pas tout le temps
    Par elizabeth dans le forum jQuery
    Réponses: 6
    Dernier message: 02/01/2012, 11h30
  3. Syntax error, mais pas tout le temps !
    Par julien731 dans le forum Langage
    Réponses: 4
    Dernier message: 20/01/2011, 18h30
  4. Réponses: 21
    Dernier message: 08/01/2010, 16h15
  5. DISK BOOT FAILURE mais pas tout le temps
    Par mitmat dans le forum Windows Vista
    Réponses: 3
    Dernier message: 08/04/2009, 09h38

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