Bonjour,

J'ai un formulaire formulaire.html

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
<html>
<form method="POST" action="add.php">
<center>
<input type="text" name="nom" size="10" value="18/03/2009" maxlength="10"><br>
<input type="submit" value="Envoyer" name="envoyer">
</center>
</form>
</html>
Mon objectif est d'envoyer la valeur date DD/MM/YYYY dans une page add.php mais je n'arrive pas peut du fait des simples quotes à mettre $nom dans ma clause where "where trunc(STA_DATE) = '$nom'" j'ai besoin des simples quotes...j'ai essayé de mettre des doubles quotes ' " $nom ' " plus d'autres tests dont je ne me souviens plus. Il faut que j'affiche le resultat de ma selection en prenant en compte ma valeur date.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
// On commence par récupérer les champs
if(isset($_POST['nom']))      $nom=$_POST['nom'];
else      $nom="";
 
// On vérifie si les champs sont vides
if(empty($nom))
    {
    echo '<font color="red">Attention, le champs <b>DATE</b> est vide !</font>';
    }
 
// Aucun champ n'est vide, on peut enregistrer dans la table
else
    {
echo "$nom";
 
 
$db = "//********************";
$c1 = oci_connect("******", "******", $db);
 
 
function select_data($conn)
{
 
$query1 = "ALTER SESSION SET NLS_DATE_FORMAT='DD/MM/YYYY HH24:MI:SS'";
$stid1 = oci_parse($conn, $query1);
$r1 =oci_execute($stid1, OCI_COMMIT_ON_SUCCESS);
 
 
$stmt = oci_parse($conn, "select STA_TRAIT, STA_TYPE, STA_FLAG, STA_DATE, NOM_FICHIER, LOADER, READ, DISCARDED, REJECTED, TAUX_REJET from USER.MA_TABLE where trunc(STA_DATE) = '18/03/2010' order by STA_DATE desc");
 
 
oci_execute($stmt, OCI_DEFAULT);
 
echo "<TABLE BORDER=0 BORDERCOLOR=#152B28>";
echo "<tr BGCOLOR=#96CDC5 ALIGN=CENTER><th><FONT COLOR=#152B28>Traitements</FONT></th><th><FONT COLOR=#152B28>Types</FONT></th><th><FONT COLOR=#152B28>Flags</FONT></th><th><FONT COLOR=#152B28>Dates</FONT></th><th><FONT COLOR=#152B28>Nom de fichier</FONT></th><th><FONT COLOR=#152B28>Chargements</FONT></th><th><FONT COLOR=#152B28>Lecture</FONT></th><th><FONT COLOR=#152B28>Rejets</FONT></th><th><FONT COLOR=#152B28>Erreurs</FONT></th><th><FONT COLOR=#152B28>Taux de rejet</FONT></th>";
while (oci_fetch($stmt)) {
        echo "<tr BGCOLOR=#DCF4F1 ALIGN=LEFT>";
        echo "<td><b>" . oci_result($stmt, "STA_TRAIT") ."</b></td>";
        echo "<td>" . oci_result($stmt, "STA_TYPE") ."</td>";
        echo "<td>" . oci_result($stmt, "STA_FLAG") ."</td>";
        echo "<td ALIGN=CENTER>" . oci_result($stmt, "STA_DATE") ."</td>";
        echo "<td>" . oci_result($stmt, "NOM_FICHIER") ."</td>";
        echo "<td>" . oci_result($stmt, "LOADER") ."</td>";
        echo "<td>" . oci_result($stmt, "READ") ."</td>";
        echo "<td ALIGN=CENTER>" . oci_result($stmt, "DISCARDED") ."</td>";
        echo "<td>" . oci_result($stmt, "REJECTED") ."</td>";
        echo "<td>" . oci_result($stmt, "TAUX_REJET") ."</td>";
        echo "</tr>";
}
echo "</TABLE>";
 
}
 
select_data($c1);
 
}
 
 
?>
Merci pour votre aide...
Si vous pensez qu'il existe une méthode plus simple, je suis preneur...

A+ Stéphane