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 :

affichage d'un formulaire page par page


Sujet :

PHP & Base de données

  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    65
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

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

    Informations forums :
    Inscription : Avril 2011
    Messages : 65
    Points : 26
    Points
    26
    Par défaut affichage d'un formulaire page par page
    Bonjours

    SVP , qui peut m'aider,,j'ai un script php dont le quel je voudrais afficher un formulaire page par page (5O enrigistrement par page suivant id)
    j'ai fait le code mais rien est fait ,il m'affiche les 200 enrigistrement que j'ai .. pourtant il n'apparait accun erreur...
    svp ,qui peut m'aider ou se trouve l'erreur.. et ça sera synpa de sa coté
    voici le code..
    ///////////////////////////////////////////////////
    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
     
    <?php
    session_start();
    //require("afficher.php");
    include("connexion.php");
    connect($host,$user,$mot_passe,$db_name);
    if ( !session_is_registered("authen_user")){
    #echo '<META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php?erreur=404">';
    #redirection instantanée
    header("location:index.php?erreur=404");
    }
    //$id=$POST['id'];
    //$sql="select nom from pc WHERE n_serie ='8TMLM4J';
    //mysql_query("$sql");
    //WHILE($tab=mysql_fetch_array($rs)){
    	// echo $tab[nom];}
    //$sql = mysql_query("SELECT Id FROM utilisateurs Where Identifiant ='".$user."' AND Pwd ='".$mot_passe."'") ;
     //$result=mysql_num_rows($sql);
     //$_SESSION['Id']=$result['Id'];
     //$row = mysql_fetch_assoc($sql);
     //$_SESSION['Id'] = $row['Id'];
    	if (isset($_SESSION['login_successful'])){
     echo "<p align=center><b><font face=Arial size=5 color=red>Bonjours </font></b></p>";
     }
    ?>
     
     <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <link href="css/style.css" rel="stylesheet">
    <title></title>
    </head>
    <body topmargin="0" leftmargin="0">
    &nbsp;
    <table width="1265" height="902"  border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" bgcolor="#FFFFFF" style="border-collapse: collapse">
    <tr>
        <td width="100%" height="126" align="left" valign="top">
    <table WIDTH="1265" BORDER="0" CELLPADDING="0" CELLSPACING="0">
                <tr>
                    <td COLSPAN="6"><img SRC="img/header.jpg" WIDTH="387" HEIGHT="94"> </td>
               </tr>
    	       <tr>
                 <td width="89"><a class="linx" href="user_home.php">Consultation  </a></td>
                    <td width="111"><a class="linx" href="new.php">Ajouter nouveau</a></td>
                    <td width="80"><a class="linx" href="find.php">Recherche</a></td>
    			 <td width="100"><a class="linx" href="excel.php">Exportation Excel</a></td>
                   <td width="175">&nbsp;
    			   </td>
                   <td width="87"><a class="linx" href="deco.php">D&eacute;connecxion</a></td>
              </tr>
    		  <tr>
    		    <td COLSPAN="6">
     
    </td>
    	    </tr>
          </table>    </td>
    </tr>
    <tr>
         <td  valign="top"><hr>
    	 <table width="1265"  BORDER="1" bordercolor="#BDE7F7" CELLPADDING="0" CELLSPACING="0">
    	   <tr>
    	     <th width="39"><p align="left" class=text2>N&deg;</th>
    		 <th width="90"><p align="left" class=text2>N&deg; de s&eacute;rie</th>
    		 <th width="107" ><p align="left" class=text2>N&deg;d'immo</th>
    		 <th width="124" ><p align="left" class=text2>N&deg;de Commande</th>
    		 <th width="118" ><p align="left" class=text2>Model</th>
    		 <th width="115" ><p align="left" class=text2>Date de  r&eacute;ception</th>
    		 <th width="105"><p align="left" class=text2>statut affectation</th>
    		 <th width="82"><p align="left" class=text2>statut Pc</th>
    		 <th width="195"><p align="left" class=text2><strong>b&eacute;n&eacute;ficiaire</strong></th>
    		 <th width="105"><p align="left" class=text2>Modifier  statut Affectation</th>
    		 <th width="161"><p align="left" class=text2>Modifier  statut pc</th>
    	   </tr>
    	   <?php
    	   $sql="select * from pc ORDER BY id ASC LIMIT 50";
    	   $result = mysql_query($sql) or die ('Erreur : '.mysql_error() );
            $total = mysql_num_rows($result);
    	   //$rs=mysql_query("$sql");
    	   //$total = mysql_num_rows($rs);
    	   $i=1;
    	   //while($tab=mysql_fetch_array($rs))
    	   if($total)
    	   { 
     
    	     echo "<tr>";
    		 echo "<td valign=top><p class=text2>$i</td>";
    	     echo "<td valign=top><p class=text2>$tab[1]</td>";
    		 echo "<td valign=top><p class=text2>$tab[2]</td>";
    		 echo "<td valign=top><p class=text2>$tab[11]</td>";
    		 echo "<td valign=top><p class=text2>$tab[12]</td>";
    		 echo "<td valign=top><p class=text2>$tab[9]</td>";
    		 echo "<td valign=top><p class=text2>$tab[7]</td>";
    		 echo "<td valign=top><p class=text2>$tab[8]</td>";
    		 echo "<td><p class=text2><img src=img/arrow1.gif border=0> Nom :$tab[3]<br>
    		 <img src=img/arrow1.gif border=0> Pr&eacute;nom :$tab[4]<br> 
    		 <img src=img/arrow1.gif border=0> matricule :$tab[5] <br> 
    		 <img src=img/arrow1.gif border=0> Service/UF :$tab[6]<br>
    		 <img src=img/arrow1.gif border=0> Date d'affectation :$tab[10]
    		 </td>";
    		 if ($tab[8]!="Rebut"){
    		 if ($tab[7]!="Affecté"){
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=histo.php?id=$tab[0]>Historique</a><br>
    		 <a class=linx href=affect.php?id=$tab[0]>Affecter</a><br>
    		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
    		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
    		 </td>";
    		}
    		 else{
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=histo.php?id=$tab[0]>Historique</a><br>
    		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
    		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
    		 </td>";
    	    }
    		 }
    		 else{
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=histo.php?id=$tab[0]>Historique</a><br>
    		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
    		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
    		 </td>";
    	    }
     
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=update3.php?id=$tab[0]>Signaler fonctionnel</a><br>
    		 <a class=linx href=updat4.php?id=$tab[0]>Signaler en reparation</a><br>
    		 <a class=linx href=update2.php?id=$tab[0]>Signaler rebut</a><br>
    		 <a class=linx href=raffect.php?id=$tab[0]>Réafecter</a><br>
    		 </td>";
    	     echo "</tr>";
    		 $i++;
    		 $nombre = 50;  // on va afficher 50 résultats par page.
    		 $nombre = 50;  // on va afficher 50 résultats par page.
        if (!isset($limite)){ $limite = 0; 
     
        $path_parts = pathinfo($_SERVER['PHP_SELF']);
         $page = $path_parts['pc_sagem'];
    	 }
    	 // initialisation des variable suivant et précédent
    	 $limitesuivante = $limite + $nombre;
          $limiteprecedente = $limite - $nombre;
    	  // button "précedent"
      //<form action="<?php echo $page; ?>" method="post">
      <?php
        if($limite != 0) {
       <form methode="post" action="<?php echo $page; ?>">
        <input type="submit" name="xxx" value="précédents" />
        <input type="hidden" name="limite"" value="<?php echo $limiteprecedente; ?>"/>
        </form>
    	?>
    	if($limitesuivante < $total) 
     
      <form methode="post" action="<?php echo $page;?>" >
        <input type="submit" name="yyy" value="="suivants"/>
        <input type="hidden" name="limite" value="<?php echo $limitesuivante; ?>" />
      </form>
      ?>  
    }
    }
    }
    ?>
        </table>
     
        </td>	   
    </tr>
    </table>
    </body>
    </html>

  2. #2
    Invité
    Invité(e)
    Par défaut
    Citation Envoyé par pfakhmaies Voir le message
    pourtant il n'apparait accun erreur...
    Bonjour, je peux t'assurer que ton code est bourré d'erreurs !

    - ligne 23 : un echo ... AVANT <html> ??? (il devrait etre dans le <body>)
    - ligne 147 : il manque une fermeture ?>
    - ...

    CONSEIL : évite de mettre du code html dans du code php
    (par exemple : )
    remplace
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <?php
    	if($total)
    	{ 
    		echo "<tr>";
    		echo "<td valign=top><p class=text2>$i</td>";
    		echo "<td valign=top><p class=text2>$tab[1]</td>";
    		// ...
    	}
    ?>
    par :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <?php
    	if($total)
    	{ 
    ?>
    		<tr>
    		<td valign="top"><p class="text2"><?php echo $i; ?></td>
    		<td valign="top"><p class="text2"><?php echo $tab[1]; ?></td>
    		// ...
    <?php
    	}
    ?>

  3. #3
    Nouveau membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    65
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

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

    Informations forums :
    Inscription : Avril 2011
    Messages : 65
    Points : 26
    Points
    26
    Par défaut
    bonjours,,

    j'ai essayé avec votre proposition , mais rien a changé , de plus il m'apparait un erreur a ligne 178 .
    voici ma modification;
    /////////////////////////////////////////////
    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
     
    <?php
    session_start();
    //require("afficher.php");
    include("connexion.php");
    connect($host,$user,$mot_passe,$db_name);
    if ( !session_is_registered("authen_user")){
    #echo '<META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php?erreur=404">';
    #redirection instantanée
    header("location:index.php?erreur=404");
    }
    //$id=$POST['id'];
    //$sql="select nom from pc WHERE n_serie ='8TMLM4J';
    //mysql_query("$sql");
    //WHILE($tab=mysql_fetch_array($rs)){
    	// echo $tab[nom];}
    //$sql = mysql_query("SELECT Id FROM utilisateurs Where Identifiant ='".$user."' AND Pwd ='".$mot_passe."'") ;
     //$result=mysql_num_rows($sql);
     //$_SESSION['Id']=$result['Id'];
     //$row = mysql_fetch_assoc($sql);
     //$_SESSION['Id'] = $row['Id'];
    	if (isset($_SESSION['login_successful'])){
     echo "<p align=center><b><font face=Arial size=5 color=red>Bonjours </font></b></p>";
     }
    ?>
     
     <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <link href="css/style.css" rel="stylesheet">
    <title></title>
    </head>
    <body topmargin="0" leftmargin="0">
    &nbsp;
    <table width="1265" height="902"  border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" bgcolor="#FFFFFF" style="border-collapse: collapse">
    <tr>
        <td width="100%" height="126" align="left" valign="top">
    <table WIDTH="1265" BORDER="0" CELLPADDING="0" CELLSPACING="0">
                <tr>
                    <td COLSPAN="6"><img SRC="img/header.jpg" WIDTH="387" HEIGHT="94"> </td>
               </tr>
    	       <tr>
                 <td width="89"><a class="linx" href="user_home.php">Consultation  </a></td>
                    <td width="111"><a class="linx" href="new.php">Ajouter nouveau</a></td>
                    <td width="80"><a class="linx" href="find.php">Recherche</a></td>
    			 <td width="100"><a class="linx" href="excel.php">Exportation Excel</a></td>
                   <td width="175">&nbsp;
    			   </td>
                   <td width="87"><a class="linx" href="deco.php">D&eacute;connecxion</a></td>
              </tr>
    		  <tr>
    		    <td COLSPAN="6">
     
    </td>
    	    </tr>
          </table>    </td>
    </tr>
    <tr>
         <td  valign="top"><hr>
    	 <table width="1265"  BORDER="1" bordercolor="#BDE7F7" CELLPADDING="0" CELLSPACING="0">
    	   <tr>
    	     <th width="39"><p align="left" class=text2>N&deg;</th>
    		 <th width="90"><p align="left" class=text2>N&deg; de s&eacute;rie</th>
    		 <th width="107" ><p align="left" class=text2>N&deg;d'immo</th>
    		 <th width="124" ><p align="left" class=text2>N&deg;de Commande</th>
    		 <th width="118" ><p align="left" class=text2>Model</th>
    		 <th width="115" ><p align="left" class=text2>Date de  r&eacute;ception</th>
    		 <th width="105"><p align="left" class=text2>statut affectation</th>
    		 <th width="82"><p align="left" class=text2>statut Pc</th>
    		 <th width="195"><p align="left" class=text2><strong>b&eacute;n&eacute;ficiaire</strong></th>
    		 <th width="105"><p align="left" class=text2>Modifier  statut Affectation</th>
    		 <th width="161"><p align="left" class=text2>Modifier  statut pc</th>
    	   </tr>
    	   <?php
    	   $sql="select * from pc ORDER BY id ASC LIMIT 50";
    	   $result = mysql_query($sql) or die ('Erreur : '.mysql_error() );
            $total = mysql_num_rows($result);
    	   //$rs=mysql_query("$sql");
    	   //$total = mysql_num_rows($rs);
    	   $i=1;
    	   ?>
    	   //while($tab=mysql_fetch_array($rs))
    	   <?php
    	   if($total)
    	   { 
    	   ?>
     
    	      <tr>
    		 <td valign="top"><p class=text2><?php echo $i; ?></td>
    	     <td valign="top"><p class=text2><?php echo $tab[1]; ?></td>
    		 <td valign="top"><p class=text2><?php echo $tab[2]; ?></td>
    		 <td valign="top"><p class=text2><?php echo $tab[11]; ?></td>
    		<td valign="top"><p class=text2><?php echo $tab[12]; ?></td>
    		 <td valign="top"><p class=text2><?php echo $tab[9]; ?></td>
    		 <td valign="top"><p class=text2><?php echo $tab[7]; ?></td>
    		 <td valign="top"><p class=text2><?php echo $tab[8]; ?></td>
    		 <td><p class=text2><img src=img/arrow1.gif border=0> Nom :$tab[3]<br>
    		 <img src=img/arrow1.gif border=0> Pr&eacute;nom :$tab[4]<br> 
    		 <img src=img/arrow1.gif border=0> matricule :$tab[5] <br> 
    		 <img src=img/arrow1.gif border=0> Service/UF :$tab[6]<br>
    		 <img src=img/arrow1.gif border=0> Date d'affectation :$tab[10]
    		 </td>";
     
    		 if ($tab[8]!="Rebut"){
    		 if ($tab[7]!="Affecté"){
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=histo.php?id=$tab[0]>Historique</a><br>
    		 <a class=linx href=affect.php?id=$tab[0]>Affecter</a><br>
    		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
    		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
    		 </td>";
    		 <?php
    		}
    		?>
    		 else{
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=histo.php?id=$tab[0]>Historique</a><br>
    		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
    		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
    		 </td>";
    	    }
    		 }
    		 else{
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=histo.php?id=$tab[0]>Historique</a><br>
    		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
    		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
    		 </td>";
    	    }
     
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=update3.php?id=$tab[0]>Signaler fonctionnel</a><br>
    		 <a class=linx href=updat4.php?id=$tab[0]>Signaler en reparation</a><br>
    		 <a class=linx href=update2.php?id=$tab[0]>Signaler rebut</a><br>
    		 <a class=linx href=raffect.php?id=$tab[0]>Réafecter</a><br>
    		 </td>";
    	     echo "</tr>";
    		 $i++;
    		 $nombre = 50;  // on va afficher 50 résultats par page.
    		 $nombre = 50;  // on va afficher 50 résultats par page.
    		 <?php
        if (!isset($limite)){
     
    	$limite = 0; 
     
        $path_parts = pathinfo($_SERVER['PHP_SELF']);
         $page = $path_parts['pc_sagem'];
    	 // initialisation des variable suivant et précédent
    	 $limitesuivante = $limite + $nombre;
          $limiteprecedente = $limite - $nombre;
    	  // button "précedent"
      //<form action="<?php echo $page; ?>" method="post">
      ?>
      }
      <?php
        if($limite != 0) {
    	?>
       <form methode="post" action="<?php echo $page; ?>"/>
        <input type="submit" name="xxx" value="précédents" />
        <input type="hidden" name="limite"" value="<?php echo $limiteprecedente; ?>"/>
        </form>
    	?>
    	if($limitesuivante < $total) 
     
      <form methode="post" action="<?php echo $page;?>" >
        <input type="submit" name="yyy" value="="suivants"/>
        <input type="hidden" name="limite" value="<?php echo $limitesuivante; ?>" />
      </form> 
    }
    }
    }
    ?>
        </table>
     
        </td>	   
    </tr>
    </table>
    </body>
    </html>

  4. #4
    Invité
    Invité(e)
    Par défaut
    ligne 103 (entre autres)

  5. #5
    Membre éclairé Avatar de micetf
    Homme Profil pro
    Professeur des Ecoles
    Inscrit en
    Mai 2009
    Messages
    557
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ardèche (Rhône Alpes)

    Informations professionnelles :
    Activité : Professeur des Ecoles
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2009
    Messages : 557
    Points : 831
    Points
    831
    Par défaut
    Voire même à partir de la ligne 97, PHP ou HTML ? on ne sait plus où on en est.

Discussions similaires

  1. [ActionForm] Un ActionForm par formulaire ou par page ?
    Par ultracoxy dans le forum Struts 1
    Réponses: 7
    Dernier message: 16/06/2006, 15h31
  2. [SQL] Script d'affichage page par page
    Par x2thez dans le forum PHP & Base de données
    Réponses: 8
    Dernier message: 10/05/2006, 15h48
  3. [MySQL] Affichage page par page et requêtes du type $sql .=
    Par carelha dans le forum PHP & Base de données
    Réponses: 7
    Dernier message: 06/04/2006, 17h12
  4. [Tableaux] PB liens apres affichage page par page
    Par x2thez dans le forum Langage
    Réponses: 16
    Dernier message: 15/03/2006, 16h58
  5. [MySQL] afficher plusieurs enregistrements par page par page à la volée
    Par pod1978 dans le forum PHP & Base de données
    Réponses: 4
    Dernier message: 14/03/2006, 12h22

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