website logo
Auteur
avatar
mick66

Forum » » Questions » » [Résolu] - Pb requete sql dans function


Posté : 4 juin 2013 à 17:08 icone du post


function lnl_list() {
   global $hlpfile;
   global $NPDS_Prefix;
  
   !include! ("header.php");
   GraphicAdmin($hlpfile);
   opentable();
   if (isset($_POST['lnl_send'])) {
    //Vide la table 'nom_de_la_table'
    $query = "TRUNCATE TABLE `lnl_send`";
    $result = sql_query($query);
    echo('test');
}
   $result = sql_query("select ref, header , body, footer, number_send, type_send, date, status from ".$NPDS_Prefix."lnl_send ORDER BY date");
   echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">\n";
   echo adm_translate("Liste des LNL envoyées");
   echo "</td></tr></table>\n";
   echo "<br /><table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">";
   echo "<tr>";
   echo "<td class=\"ongl\">Num.</td>";
   echo "<td class=\"ongl\">".adm_translate("Entête")."</td>";
   echo "<td class=\"ongl\">".adm_translate("Corps")."</td>";
   echo "<td class=\"ongl\">".adm_translate("Pied")."</td>";
   echo "<td class=\"ongl\">".adm_translate("Nbre d'envois effectués")."</td>";
   /*echo "<td class=\"ongl\">".adm_translate("Type")."</td>";*/
   echo "<td class=\"ongl\">Date</td>";
   echo "<td class=\"ongl\">Status</td>";
   echo "</tr>";
   while (list($ref, $header, $body, $footer, $number_send, $type_send, $date, $status) = sql_fetch_row($result)) {
         $rowcolor = tablos();
         echo "<tr $rowcolor>";
         echo "<td>$ref</td>";
         echo "<td>$header</td>";
         echo "<td>$body</td>";
         echo "<td>$footer</td>";
         echo "<td>$number_send</td>";
         /*echo "<td>$type_send</td>";*/
         echo "<td>$date</td>";
         if ($status=="NOK") {
            echo "<td class=\"rouge\">$status</td>";
         } else {
            echo "<td>$status</td>";
         }
      echo "</tr>";
   }
   echo "</table><br />";
   echo "[ <a href=\"!javascript!:history.go('1)\" class=\"noir\">".adm_translate("Retour en arrière")."</a> ]";
//Formulaire
echo "
<form method=\"post\" action=".$_SERVER['PHP_SELF'].">
    <input type=hidden value=\"lnl_send\">
    <input type=submit value=\"Vider la table\">
</form>
";
   closetable();
   !include! ("footer.php");
}


Cet article provient de NPDS
https://www.npds.org/viewtopic.php?topic=25864&forum=9