Probleme avec php

julien -  
 julien -
Bonjour,
je doi cré une page en php pour une vente au enchere.lorsque je rentre un prix dans la case, il l'enregistre dans la base de donnés mais il ne sait pas a quel objet cela apartient,il ne doit pas arriver a savoir que cette case est pour cette objet malgres le from. voici mon tableau enchere.

objet id objet nom étudiant date enchere prix début prix proposé proposé une enchère
corde à sauter obj003 TRUCK 2008-03-07 13 € 30 € enregister

malette Poker obj005 MARTIN 2007-04-30 170 € 475 € enregister

voici mes derniere ligne de code:

<?php
$resultat = mysql_query("SELECT nom_obj,ref_objet,nom_etud,Ref_etudiant,id_obj,descriptif_obj,fin_ench,date_enchere,promo_etud,prix_debut,MAX( prix_propose ) AS prix_propose FROM (enchere RIGHT JOIN objet ON ref_objet = id_obj) LEFT JOIN etudiants ON Ref_etudiant = identifiant GROUP BY nom_obj");
while($ligne = mysql_fetch_array($resultat))
{

?>
<form id="form4" name="form4" method="POST" action="feuille 4 1projet web.php">
<tr class="ligne<?php echo $i;?>">
<td><?php echo $ligne['nom_obj'];?></td>
<td><?php echo $ligne['id_obj']?></td>
<td><?php echo $ligne['descriptif_obj'];?></td>
<td><?php echo $ligne['nom_etud'];?></td>
<td><?php echo $ligne['promo_etud'];?></td>
<td><?php echo $ligne['fin_ench'];?></td>
<td><?php echo $ligne['date_enchere'];?></td>
<td><?php echo $ligne['prix_debut'];?> €</td>
<td><?php echo $ligne['prix_propose'];?> €</td>

<td><input type="text" name="propose_prix" id="propose_prix"/></td>
<td><input type="hidden" value="<?php echo $ligne['id_obj'] name="ref_obj"?>"><input type="submit" name="valider" id="valider" value="enregister"/></td>
<td><input type="hidden" value="<?php echo $ligne['MAX( prix_propose )'] name="prixmax"?>
</tr>
</form>
<?php }

if(isset($_POST['propose_prix']))
{if($_POST['MAX( prix_propose )']>$ligne['prix_propose'])
{
$sql="INSERT INTO enchere(Ref_etudiant,ref_objet,date_enchere,prix_propose)VALUE
('".$_SESSION['idf']."', '".$$_POST['id_obj']."','".$dateenchere."','".$_POST['propose_prix']."')" ;
$req = mysql_query($sql);
echo" Votre enchere a bien ete enregistree"; ?> <br/> <?php
}
else
{
echo"miser plus";
}}
?>
Configuration: Windows XP
Internet Explorer 7.0

1 réponse

  1. ScroudaF Messages postés 131 Statut Membre 11
     
    $$_POST['id_obj']
    Il y a un $ de trop peut-être?

    Je n'ai pas bien compris ton problème...
    0
    1. julien
       
      Non, je l'ai remodifié apre avoir ecri le l'annonce ou g vu cette faute.
      C'est un site de vente au enchere, en face de chaque ligne il y a une case a remplir avec un bouton enregistrer pour réencherir.Le probleme c'est qu'il ne sait pas quel objet je réenchri.
      voila ce que j'ai écrit:


      $_SESSION['idf']='dupoma250';
      ?>
      <!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
      <head>
      <title>ENCHERE EN COURS</title>
      <link href="mise en forme enchere en cours.css" rel="stylesheet"type="text/css"/>
      </head>
      <body>
      <div id="titre"> L'ATR : acheter, vender c'est pas compliqué </div>
      <div id="cadre">
      <div id="liste"> Les encheres en cours </div>
      <?php
      $maconnexion= mysql_connect('localhost', 'root', '');
      mysql_select_db('projet2');


      ?>

      <table>
      <tr >
      <th scope="col">objet</th>
      <th scope="col">id objet</th>
      <th scope="col">description objet</th>
      <th scope="col">nom étudiant</th>
      <th scope="col">promotion</th>
      <th scope="col">fin enchère</th>
      <th scope="col">date enchere</th>
      <th scope="col">prix début</th>
      <th scope="col">prix proposé</th>
      <th scope="col">proposé une enchère</th>

      </tr>

      <?php
      $resultat = mysql_query("SELECT nom_obj,ref_objet,nom_etud,Ref_etudiant,id_obj,descriptif_obj,fin_ench,date_enchere,promo_etud,prix_debut,MAX( prix_propose ) AS prix_propose FROM (enchere RIGHT JOIN objet ON ref_objet = id_obj) LEFT JOIN etudiants ON Ref_etudiant = identifiant GROUP BY nom_obj");
      while($ligne = mysql_fetch_array($resultat))
      {

      ?>
      <form id="form4" name="form4" method="POST" action="feuille 4 1projet web.php">
      <tr class="ligne<?php echo $i;?>">
      <td><?php echo $ligne['nom_obj'];?></td>
      <td><?php echo $ligne['id_obj']?></td>
      <td><?php echo $ligne['descriptif_obj'];?></td>
      <td><?php echo $ligne['nom_etud'];?></td>
      <td><?php echo $ligne['promo_etud'];?></td>
      <td><?php echo $ligne['fin_ench'];?></td>
      <td><?php echo $ligne['date_enchere'];?></td>
      <td><?php echo $ligne['prix_debut'];?> €</td>
      <td><?php echo $ligne['prix_propose'];?> €</td>

      <td><input type="text" name="propose_prix" id="propose_prix"/></td>
      <td><input type="hidden" value=" <?php $ligne['id_obj'] ?>" name="ref_obj"><input type="hidden" value="<?php echo $ligne['MAX( prix_propose )']?>" name="prixmax"><input type="submit" name="valider" id="valider" value="enregister"/></td>

      </tr>
      </form>
      <?php }



      if(isset($_POST['propose_prix']))
      {if($_POST['propose_prix']>$_POST['MAX( prix_propose )'])
      {
      $sql="INSERT INTO enchere(Ref_etudiant,ref_objet,date_enchere,prix_propose)VALUE
      ('".$_SESSION['idf']."', '".$_POST['id_obj']."','".Date("Y-m-d-G")."','".$_POST['propose_prix']."')" ;
      $req = mysql_query($sql);
      echo" Votre enchere a bien ete enregistree"; ?> <br/> <?php
      }
      else
      {
      echo"miser plus";
      }}
      ?>


      </table>
      </body>

      </html>
      0