Requete SQL affichage données

pxone Messages postés 67 Date d'inscription   Statut Membre Dernière intervention   -  
Melooo Messages postés 1476 Statut Membre -
Bonjour,
Je souhaiterai seulement afficher les enregistrements qui sont à la date du jour

$datejour = date("Y-m-d");?>
<?php $requete="SELECT * FROM reception ORDER BY date DESC LIMIT 0,10 WHERE date=$datejour";?>

3 réponses

  1. .Zoro. Messages postés 285 Statut Membre 33
     
    il faudrai que tu precise
    ton probleme et ta question
    c'est plus facile pour aider
    1
  2. pxone Messages postés 67 Date d'inscription   Statut Membre Dernière intervention  
     
    Mon tableau est vide voici les erreurs afficheés
    Notice: Use of undefined constant act - assumed 'act' in C:\wamp\www\projet\arrivee\distri.php on line 9

    Notice: Undefined index: act in C:\wamp\www\projet\arrivee\distri.php on line 9

    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\projet\arrivee\distri.php on line 43
    0
    1. Melooo Messages postés 1476 Statut Membre 84
       
      Donne nous le code
      0
    2. pxone Messages postés 67 Date d'inscription   Statut Membre Dernière intervention  
       
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
      <?php include "fonctions/connection.inc.php"; ?>
      <?php include "fonctions/fonction_date.php"; ?><title>Gestion Plis arrivee</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><style type="text/css">

      </style></head><body>
      <?php //----------------------------------Suppression---------------------
      if ($_GET[act]=="supp")
      {
      $reqsuppression="DELETE FROM reception WHERE id=$_GET[id]";
      mysql_query($reqsuppression,$id_conn); // Fonction d'éxecution de la requete
      }
      //----------------------------------fin Suppression---------------------
      //--------D?claration de variables---------
      $datejour = date("Y-m-d");
      //--------D?claration de variables---------
      ?>
      <?php $requete="SELECT * FROM reception ORDER BY date DESC LIMIT 0,10 WHERE date=date('Y-m-d')";
      $resultat=mysql_query($requete);

      ?>

      <table style="text-align: left; width: 987px; height: 145px;" border="1"
      cellpadding="2" cellspacing="2">
      <tbody>
      <tr align="center">
      <td colspan="10" rowspan="1"
      style="vertical-align: top; background-color: rgb(204, 204, 204);"><big><big>REMISES CONTRADICTOIRES </big></big></td>
      </tr>
      <tr>
      <td style="font-weight: bold;"><big><big>Date</big></big></td>
      <td style="font-weight: bold;"><big>Quantité</big></td>
      <td style="font-weight: bold;"><big>Transporteur</big></td>
      <td style="font-weight: bold;"><big>N° de suivi</big></td>
      <td style="font-weight: bold;"><big>Expediteur</big></td>
      <td style="font-weight: bold;"><big>Code postal</big></td>
      <td style="font-weight: bold;"><big>Pays</big></td>
      <td style="font-weight: bold;"><big>Destinataire</big></td>
      <td style="font-weight: bold;"><big>Service</big></td>
      <td style="font-weight: bold;"><big>Signature</big></td>
      </tr>
      <?php while($reception=mysql_fetch_array($resultat)) { ?>
      <?php $ordre=fr_mysql;//Variable pour conversion de date US vers FR
      $date=convertir_date($reception['date'],$ordre) //Fonction pour conversion de date US vers FR
      ?>
      <tr>
      <td style="height: 57px;"><big><big><?php echo $date ; ?></big></big></td>
      <td style="height: 57px;"><big><big><?php echo $reception['nombre'] ?></big></big></td>
      <td style="height: 57px;"><big><big><?php echo $reception['transporteur'] ?></big></big></td>
      <td style="height: 57px;"><big><big><?php echo $reception['suivi'] ?></big></big></td>
      <td style="height: 57px;"><big><big><?php echo $reception['expediteur'] ?></big></big></td>
      <td style="height: 57px;"><big><big><?php echo $reception['codepostal'] ?></big></big></td>
      <td style="height: 57px;"><big><big><?php echo $reception['pays'] ?></big></big></td>
      <td style="height: 57px;"><big><big><?php echo $reception['destinataire'] ?></big></big></td>
      <td style="height: 57px;"><big><big><?php echo $reception['service'] ?></big></big></td>
      <td style="height: 57px;"><big><big>:</big></big></td>
      </tr>
      <?php } ?>
      </tbody></table>
      <?php echo"<div align=\"center\"><a href=\"javascript:window.print()\">Imprimer cette page</a>"; ?>
      </body></html>
      0
    3. Melooo Messages postés 1476 Statut Membre 84
       
      <?php include "fonctions/connection.inc.php"; ?>
      <?php include "fonctions/fonction_date.php"; ?>
      

      Je ferais plutôt comme ca :
      <?php
      include ('fonctions/connection.inc.php");
      include ('fonctions/fonction_date.php");
      ?>
      

      Ton $_GET['act'] vient d'ou ?
      0
    4. pxone Messages postés 67 Date d'inscription   Statut Membre Dernière intervention  
       
      d'une autre page pour la suppression des enregistrement cela marche tres bien
      0
    5. Melooo Messages postés 1476 Statut Membre 84
       
      Apparement pas tant que sa, car ca provoque une erreur
      0
  3. pxone Messages postés 67 Date d'inscription   Statut Membre Dernière intervention  
     
    Disons que dans mon tableau je voudrais afficher que les enregistrement du jour
    donc je declare une variable $datejour et je la compare a la date enregistré dans ma base de donnees
    Merci de ton aide !
    -1
    1. Melooo Messages postés 1476 Statut Membre 84
       
      Bonjour,
      Tu as une erreur ?
      Si oui, laquelle ?
      Sinon il me semble que la clause LIMIT se met après le where ;)
      0
    2. pxone Messages postés 67 Date d'inscription   Statut Membre Dernière intervention  
       
      Sinon a par le LIMIT tu penses que ma syntaxe est bonne je peux pas encore tester je suis au travail :-(
      0
    3. Melooo Messages postés 1476 Statut Membre 84
       
      oui je pense que ta syntaxe est bonne ;)
      tu peux même "bazarder" ta variable $datejour et faire ta requête comme ca :
      <?php $requete="SELECT * FROM reception ORDER BY date DESC LIMIT 0,10 WHERE date=date('Y-m-d')" ?> 
      
      0
    4. .Zoro. Messages postés 285 Statut Membre 33
       
      pour la syntaxe,
      je mettrait des guillemets autour de la date

      WHERE date="date('Y-m-d')"
      0