Pourquoi, cela n'affiche t il pas ce que je veux?

Pourquoi, cela n'affiche t il pas ce que je veux? - PHP - Programmation

Marsh Posté le 27-04-2006 à 16:36:09    

Bonjour,
 
Je suis en train de réaliser une base de données. Cependant, je bute sur un petit problème d'affichage. En fait quand je clique sur un bouton, celà lance l'affichage d'une liste de nom avec a coté de chacun, un bouton pour afficher son profil. Cepndant, quand je lance un tri sur cette liste, et que j'appuie sur le bouton profil, cela m'affiche la page profil, mais vierge, sans données... et le pire, c'est que j'ai fait un copier coller... donc je ne vois pas pourquoi ca marche pour l'un et pas pour l'autre...
 
Voici le code, si vous pouviez y jeter un coup d'oeil et m'aider à trouver mon erreur...
 

Code :
  1. table width="900px" style="margin-left:7px; margin-right:7px; margin-top:7px; margin-bottom:7px; background-color:#99CCFF;" cellpadding="10px" cellspacing="0">
  2. <caption>Employees</caption>
  3.      <tr valign="middle">
  4.       <td width="100px" valign="middle">See/Modify</td>
  5.   <td style="margin-left:7px; border-left:1px solid; border-bottom:1px solid;" width="120px" valign="middle"><big>Name</big></td>
  6.   <td style="margin-left:7px; border-left:1px solid; border-bottom:1px solid;" valign="middle"><big>Firstname</big></td>
  7.   <td style="margin-left:7px; border-left:1px solid; border-bottom:1px solid;" valign="middle"><big>Function</big></td>
  8.   <td style="margin-left:7px; border-left:1px solid; border-bottom:1px solid;" valign="middle"><big>Group</big></td>
  9.      </tr>
  10. <?php
  11.  
  12. if (isset($_GET['i']))
  13. {
  14.    $test=$_GET['i'];
  15.    switch ($test)
  16.    {
  17.      case 'f':
  18.  
  19.   $sql="SELECT E.EMP_CODE AS CODE, EMP_NAME, EMP_FIRSTNAME, FUN_DESIGNATION, DES_NAME FROM EMPLOYEE E, FUNCTION, DESIGN_GROUP WHERE E.DES_CODE = DESIGN_GROUP.DES_CODE AND E.FUN_CODE = FUNCTION.FUN_CODE AND FUNCTION.FUN_CODE = ".$_POST['employee_function']." ORDER BY `DES_NAME` ASC;";
  20.       $result=mysql_query($sql);
  21.   for($j=0; $j<mysql_num_rows($result); $j++)
  22.   {
  23.    $num = mysql_result($result, $j, "EMP_CODE" );
  24.    $name = mysql_result($result, $j, "EMP_NAME" );
  25.    $first = mysql_result($result, $j, "EMP_FIRSTNAME" );
  26.    $func = mysql_result($result, $j, "FUN_DESIGNATION" );
  27.    $dg = mysql_result($result, $j, "DES_NAME" );
  28.       echo '<tr height="75px">';
  29.   echo '<td align="center" valign="middle"><form method="POST" action="../?i=3e"><input name="designer" type="hidden" value="'.$num.'"><input type="submit" value="&times;" class="bouton"></form></td>';
  30.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">'.$name.'</td>';
  31.   echo '<td style="margin-left:10px; border-left:1px solid;" valign="middle">'.$first.'</td>';
  32.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">'.$func.'</td>';
  33.   echo '<td style="margin-left:10px; border-left:1px solid;" valign="middle">'.$dg.'</td>';
  34.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">';
  35.      echo '</tr>';
  36.      }   
  37.       break;
  38.  
  39.      case 'g':
  40.  
  41.   $sql="SELECT E.EMP_CODE AS CODE, EMP_NAME, EMP_FIRSTNAME, FUN_DESIGNATION, DES_NAME FROM EMPLOYEE E, FUNCTION, DESIGN_GROUP WHERE E.DES_CODE = DESIGN_GROUP.DES_CODE AND E.FUN_CODE = FUNCTION.FUN_CODE AND DESIGN_GROUP.DES_CODE = ".$_POST['employee_group']." ORDER BY `EMP_NAME` ASC;";
  42.       $result=mysql_query($sql);
  43.   for($j=0; $j<mysql_num_rows($result); $j++)
  44.   {
  45.    $num = mysql_result($result, $j, "EMP_CODE" );
  46.    $name = mysql_result($result, $j, "EMP_NAME" );
  47.    $first = mysql_result($result, $j, "EMP_FIRSTNAME" );
  48.    $func = mysql_result($result, $j, "FUN_DESIGNATION" );
  49.    $dg = mysql_result($result, $j, "DES_NAME" );
  50.       echo '<tr height="75px">';
  51.   echo '<td align="center" valign="middle"><form method="POST" action="../?i=3e"><input name="designer" type="hidden" value="'.$num.'"><input type="submit" value="&times;" class="bouton"></form></td>';
  52.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">'.$name.'</td>';
  53.   echo '<td style="margin-left:10px; border-left:1px solid;" valign="middle">'.$first.'</td>';
  54.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">'.$func.'</td>';
  55.   echo '<td style="margin-left:10px; border-left:1px solid;" valign="middle">'.$dg.'</td>';
  56.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">';
  57.      echo '</tr>';
  58.      }   
  59.       break;
  60.  
  61.      default:
  62.  
  63.     $sql="SELECT `EMP_CODE`, `EMP_NAME`, `EMP_FIRSTNAME`, `FUN_DESIGNATION`, `DES_NAME` FROM `EMPLOYEE`, `FUNCTION`, `DESIGN_GROUP` WHERE EMPLOYEE.FUN_CODE = FUNCTION.FUN_CODE AND EMPLOYEE.DES_CODE = DESIGN_GROUP.DES_CODE ORDER BY `DES_NAME` ASC;";
  64. $result=mysql_query($sql);
  65. for($j=0; $j<mysql_num_rows($result); $j++)
  66. {
  67. $num = mysql_result($result, $j, "EMP_CODE" );
  68. $name = mysql_result($result, $j, "EMP_NAME" );
  69. $first = mysql_result($result, $j, "EMP_FIRSTNAME" );
  70. $func = mysql_result($result, $j, "FUN_DESIGNATION" );
  71. $dg = mysql_result($result, $j, "DES_NAME" );
  72.  
  73.     echo '<tr height="75px">';
  74.   echo '<td align="center" valign="middle"><form method="POST" action="../?i=3e"><input name="designer" type="hidden" value="'.$num.'"><input type="submit" value="&times;" class="bouton"></form></td>';
  75.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">'.$name.'</td>';
  76.   echo '<td style="margin-left:10px; border-left:1px solid;" valign="middle">'.$first.'</td>';
  77.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">'.$func.'</td>';
  78.   echo '<td style="margin-left:10px; border-left:1px solid;" valign="middle">'.$dg.'</td>';
  79.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">';
  80.      echo '</tr>';
  81.      }   
  82.       break;
  83.    }
  84. }
  85. else
  86.  $sql="SELECT `EMP_CODE`, `EMP_NAME`, `EMP_FIRSTNAME`, `FUN_DESIGNATION`, `DES_NAME` FROM `EMPLOYEE`, `FUNCTION`, `DESIGN_GROUP` WHERE EMPLOYEE.FUN_CODE = FUNCTION.FUN_CODE AND EMPLOYEE.DES_CODE = DESIGN_GROUP.DES_CODE ORDER BY `DES_NAME` ASC;";
  87. $result=mysql_query($sql);
  88. for($j=0; $j<mysql_num_rows($result); $j++)
  89. {
  90. $num = mysql_result($result, $j, "EMP_CODE" );
  91. $name = mysql_result($result, $j, "EMP_NAME" );
  92. $first = mysql_result($result, $j, "EMP_FIRSTNAME" );
  93. $func = mysql_result($result, $j, "FUN_DESIGNATION" );
  94. $dg = mysql_result($result, $j, "DES_NAME" );
  95.  
  96.     echo '<tr height="75px">';
  97.   echo '<td align="center" valign="middle"><form method="POST" action="../?i=3e"><input name="designer" type="hidden" value="'.$num.'"><input type="submit" value="&times;" class="bouton"></form></td>';
  98.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">'.$name.'</td>';
  99.   echo '<td style="margin-left:10px; border-left:1px solid;" valign="middle">'.$first.'</td>';
  100.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">'.$func.'</td>';
  101.   echo '<td style="margin-left:10px; border-left:1px solid;" valign="middle">'.$dg.'</td>';
  102.   echo '<td style="margin-left:7px; border-left:1px solid;" valign="middle">';
  103.      echo '</tr>';
  104.     }
  105. }
  106. ?>


 
 
Je vous remercie d'avance
Lyim

Reply

Marsh Posté le 27-04-2006 à 16:36:09   

Reply

Marsh Posté le 27-04-2006 à 17:10:24    

C'est bon, j'ai trouvé en fait... c'était tout con, mais j'avais pas vu...
 
ca venait de là:  
 

Code :
  1. $sql="SELECT E.EMP_CODE AS CODE, EMP_NAME, EMP_FIRSTNAME, FUN_DESIGNATION, DES_NAME FROM EMPLOYEE E, FUNCTION, DESIGN_GROUP WHERE E.DES_CODE = DESIGN_GROUP.DES_CODE AND E.FUN_CODE = FUNCTION.FUN_CODE AND DESIGN_GROUP.DES_CODE = ".$_POST['employee_group']." ORDER BY `EMP_NAME` ASC;";
  2.               $result=mysql_query($sql);
  3.             for($j=0; $j<mysql_num_rows($result); $j++)
  4.             {   
  5.                 $num = mysql_result($result, $j, "EMP_CODE");


 
 
Il fallait simplement que je remplace EMP_CODE par CODE... c'est tout! Cinq heure de perdues!
 
Merci quand même!
Lyim


Message édité par lyim le 27-04-2006 à 17:12:21
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed