Incompréhension sur l'affichage d'un tableau PHP/MYSQL
Résolu
koloma
Messages postés
4
Date d'inscription
Statut
Membre
Dernière intervention
-
koloma Messages postés 4 Date d'inscription Statut Membre Dernière intervention -
koloma Messages postés 4 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
je génère un tableau (appelé par un protocole Ajax) sur cette page PHP. ce tableau prend son contenu auprès dune table mysql, et affiche 10 lignes par 10 lignes...
quelqu'un pourrait m'expliquer pourquoi la deuxième ligne de mon tableau de s'affiche pas, et ce quelque que soit le n° de la page (ex.. de 1 à 10, la ligne 2 ne s'affiche pas, de 10 à 20, la ligne 12, etc....)...
Ca doit sauter aux yeux mais là, je sèche complétement...
Merci de votre aide
........................................................................................
<?php
$hostname_wamp = "localhost";
$database_wamp = "test";
$username_wamp = "root";
$password_wamp = "";
$wamp = mysql_pconnect($hostname_wamp, $username_wamp, $password_wamp) or trigger_error(mysql_error(),E_USER_ERROR);
session_start();
$pageNum_Recordset1 = $_SESSION['posit'];
$mouvement=$_GET['mouv'];
switch ($mouvement) {
case "I":
$_SESSION['posit']=0;
$pageNum_Recordset1=0;
break;
case "S":
$pageNum_Recordset1=$pageNum_Recordset1+1;
break;
case "P":
$pageNum_Recordset1=$pageNum_Recordset1-1;
break;
}
$_SESSION['posit']=$pageNum_Recordset1;
$maxRows_Recordset1=10;
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_wamp, $wamp);
$query_Recordset1 = "SELECT * FROM livres";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $wamp) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
echo "<table width='600' border='0' id='liste'>
<tr>
<th width='26' scope='col'> </th>
<th width='30' scope='col'>REF</th>
<th width='200' scope='col'>TITRE</th>
<th width='80' scope='col'>COUV</th>
<th width='66' scope='col'>TEST</th>
</tr>";
$i=1;
while($row = mysql_fetch_array($Recordset1))
do
{
echo "<tr class='tt' id='liste$i' onMouseOver='affnum(".$i.",0)'>";
echo "<td>" . $i . "</td>";
echo "<td>" . $row_Recordset1['REF'] . "</td>";
echo "<td>" . $row_Recordset1['TITRE'] . "</td>";
echo "<td>" . $row_Recordset1['COUV'] . "</td>";
echo "</tr>";
$i++;
}
while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
while ($i<=10)
{
echo "<tr class='tt' onMouseOver='affnum(".$i.",0)'>";
echo "<td>" . $i . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
$i++;
}
echo "</table>";
?>
je génère un tableau (appelé par un protocole Ajax) sur cette page PHP. ce tableau prend son contenu auprès dune table mysql, et affiche 10 lignes par 10 lignes...
quelqu'un pourrait m'expliquer pourquoi la deuxième ligne de mon tableau de s'affiche pas, et ce quelque que soit le n° de la page (ex.. de 1 à 10, la ligne 2 ne s'affiche pas, de 10 à 20, la ligne 12, etc....)...
Ca doit sauter aux yeux mais là, je sèche complétement...
Merci de votre aide
........................................................................................
<?php
$hostname_wamp = "localhost";
$database_wamp = "test";
$username_wamp = "root";
$password_wamp = "";
$wamp = mysql_pconnect($hostname_wamp, $username_wamp, $password_wamp) or trigger_error(mysql_error(),E_USER_ERROR);
session_start();
$pageNum_Recordset1 = $_SESSION['posit'];
$mouvement=$_GET['mouv'];
switch ($mouvement) {
case "I":
$_SESSION['posit']=0;
$pageNum_Recordset1=0;
break;
case "S":
$pageNum_Recordset1=$pageNum_Recordset1+1;
break;
case "P":
$pageNum_Recordset1=$pageNum_Recordset1-1;
break;
}
$_SESSION['posit']=$pageNum_Recordset1;
$maxRows_Recordset1=10;
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_wamp, $wamp);
$query_Recordset1 = "SELECT * FROM livres";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $wamp) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
echo "<table width='600' border='0' id='liste'>
<tr>
<th width='26' scope='col'> </th>
<th width='30' scope='col'>REF</th>
<th width='200' scope='col'>TITRE</th>
<th width='80' scope='col'>COUV</th>
<th width='66' scope='col'>TEST</th>
</tr>";
$i=1;
while($row = mysql_fetch_array($Recordset1))
do
{
echo "<tr class='tt' id='liste$i' onMouseOver='affnum(".$i.",0)'>";
echo "<td>" . $i . "</td>";
echo "<td>" . $row_Recordset1['REF'] . "</td>";
echo "<td>" . $row_Recordset1['TITRE'] . "</td>";
echo "<td>" . $row_Recordset1['COUV'] . "</td>";
echo "</tr>";
$i++;
}
while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
while ($i<=10)
{
echo "<tr class='tt' onMouseOver='affnum(".$i.",0)'>";
echo "<td>" . $i . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
$i++;
}
echo "</table>";
?>
A voir également:
- Incompréhension sur l'affichage d'un tableau PHP/MYSQL
- Tableau word - Guide
- Trier un tableau excel - Guide
- Tableau ascii - Guide
- Comment imprimer un tableau excel sur une seule page - Guide
- Tableau croisé dynamique - Guide