probleme de requete php/mysql
bonjour,
j'ai un petit souci
j'ai une requete qui affiche tous mes enregistrements voicie le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
<?php
include( "config_server.php" );
$sql = "SELECT * from clients where codeconsultant=\"".$_SESSION['login']."\"";
$req = @ mysql_query ( $sql ) or die ( 'Erreur requête !!!' );
while ( $data = @ mysql_fetch_array ( $req )) {
echo '<table width="90%" border="0" style="margin-left:30px;">';
echo '<tr>';
echo '<td width=30%>'.$data[id].'</td>';
echo '<td width=30%><a href="consultants_consultation_details.php?id='.$data[id].'">'.$data[codeaffiliation].'</a></td>';
echo '<td width=30%>'.$data[nom].'</td>';
echo '<td width=30%>'.$data[prenom].'</td>';
echo '</tr>';
echo '</table>';
}
?> |
ce qui marche très bien
donc les enregistrements sont en liste avec un lien pour avoir chaque enregistrement en détail gràce à cette ligne
Code:
1 2
|
echo '<td width=30%><a href="consultants_consultation_details.php?id='.$data[id].'">'.$data[codeaffiliation].'</a></td>'; |
donc quand je clique sur le lien de chaque ligne j'arrive bien sur la page consultants_consultation_details.php avec l'id correspondant mais dans cette page aucun champ de l'enregistrement s'affiche
voici le code de cette page
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
<?php
include( "config_server.php" );
$sql = "SELECT * FROM clients where id='$id'" ; // On sélectionne le sujet avec l'url étant donné que la page est atteinte
// comme cela view.php?id=X l'id est renseigné !
$req = @ mysql_query ( $sql ) or die ( 'Erreur requête !!!' ); // On execute la requête !
// Nous allons ressortir le message du sujet sur lequel nous avons cliquer :
$data = @ mysql_fetch_array ( $req );
while ( $data = @ mysql_fetch_array ( $req )) {
echo '<table width="90%" border="0" style="margin-left:30px;">';
echo '<tr>';
echo '<td width=30%>'.$data[id].'</td>';
echo '<td width=30%>'.$data[nom].'</td>';
echo '<td width=30%>'.$data[prenom].'</td>';
echo '<td width=30%>'.$data[adresse].'</td>';
echo '<td width=30%>'.$data[codepostal].'</td>';
echo '<td width=30%>'.$data[localite].'</td>';
echo '</tr>';
echo '</table>';
}
?> |
hors je ne vois pas d'où provient cette erreur
merci