Base de donnee

Résolu
bonsoir,j'ai fais un programme qui permet d'afficher les commande mais rien affiche ou est le problème?je ne'arrive pas a le detecter aider moi svp
donc voici le programme::::

<?php
session_start();
if(isset($_SESSION['log_cli'])){
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
<style type="text/css">
<!--
body {
background-repeat: repeat-x;
background-image: url(image/fond_degrader.jpg);
}
.Style1 {
font-size: x-large;
font-style: italic;
font-weight: bold;
}
#centre {
width: 850px;
margin: auto;
margin-top:15px;
text-align: left;
border-style: solid solid none solid;
border-color: #564EA3;
border-width: 1px;
background: #ffffff;

-moz-border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
-webkit-border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
-khtml-border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
}

#r {
background-image: url(image/9609580-multicolore-banniere-ondee-vif-avec-des-etoiles.jpg);
width: 850px;
-moz-border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
-webkit-border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
-khtml-border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
}
#ok {
border-style: solid solid none solid;
border-color: #677D92;
border-width: 2px;
margin-top:0px;
/* Haurizental/Vertical (H-Gauche H-Droite B-Droite B-Gauche)*/
-moz-border-radius: 15px 15px 0px 0px / 15px 15px 0px 0px;
-webkit-border-radius: 15px 15px 0px 0px / 15px 15px 0px 0px;
-khtml-border-radius: 15px 15px 0px 0px / 15px 15px 0px 0px;
border-radius: 15px 15px 0px 0px / 15px 15px 0px 0px;
}
#sam {

border-style: solid solid none solid;
border-color: #677D92;
border-width: 2px;
background:#ffffff;
/* Haurizental/Vertical (H-Gauche H-Droite B-Droite B-Gauche)*/
-moz-border-radius: 15px 15px 0px 0px / 15px 15px 0px 0px;
-webkit-border-radius: 15px 15px 0px 0px / 15px 15px 0px 0px;
-khtml-border-radius: 15px 15px 0px 0px / 15px 15px 0px 0px;
border-radius: 15px 15px 0px 0px / 15px 15px 0px 0px;
}

#g img{
/* Haurizental/Vertical (H-Gauche H-Droite B-Droite B-Gauche)*/
-moz-border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
-webkit-border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
-khtml-border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
border-radius: 15px 15px 15px 15px / 15px 15px 15px 15px;
}
.Style2 {
font-size: 36px;
font-style: italic;
font-weight: bold;
}
.Style3 {font-size: 18px}

-->
</style></head>

<body><div id="centre"><div id="r">
<table width="849" border="0">
<tr>
<td width="843" height="112"><div align="center" class="Style2">DBS AUTO </div></td>
</tr>
</table></div>
<table width="849" border="0">
<tr>
<td width="209"><div id="sam"><table width="205" height="585" border="0">
<tr>
<td width="199" height="42"> </td>
</tr>
<tr>
<td height="43"> </td>
</tr>
<tr>
<td height="43"> </td>
</tr>
<tr>
<td height="37"> </td>
</tr>
<tr>
<td height="43"> </td>
</tr>
<tr>
<td height="45"> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td height="98"> </td>
</tr>
</table>
</div></td>
<td width="630"><div id="ok"><table width="625" height="585" border="0">
<tr>
<td height="29" colspan="2"><div align="center" class="Style1">
espace commande
</div></td>
</tr>
<tr>
<td height="180" colspan="2">
<p align="center" class="Style3">
<?php

//connexion a la base
$connection = mysql_connect("localhost","root","");
if ( ! $connection )
die ("connection impossible");

//On sélectionne la BDD
$mabasededonnee="bdd";
mysql_select_db($mabasededonnee) or die ("pas de connection");

$e=$_SESSION['id_cli'];

$req=mysql_query("SELECT * FROM commande WHERE ((id_client='$e') && (valid_cmd='0'))");
$i=0;

while ($i<mysql_num_rows($req))
{
$ligne=mysql_fetch_row($req);
echo"
<table class='affich' align='center' cellspacing='1' >
<tr>
<td width=70%>
<b>Numéro commande :</b> ".$ligne[0]."
";$r=mysql_query("SELECT * FROM client WHERE id_client=".$ligne[0]."");
$li=mysql_fetch_row($r);
echo"
<br><b>Nom client : </b>".$li[1]."
<br><b>Prénom client : </b>".$li[2]."<br>

<br><b>Quantité X Prix U</b> | <b>Nom Produit</b> <br><br>
";

$az=mysql_query("select * from 'commande_piece' where num_com=".$ligne[0]."");
$k=0;
while ($k<mysql_num_rows($az))
{
$zz=mysql_fetch_row($az);

$produit=mysql_query("select * from 'piece' where num_p=".$zz[1]."");

$pro=mysql_fetch_row($produit);
echo "(".$zz[3]." X ".$pro[4]." DA) -------- ".$pro[1]."<br>";

$k=$k+1;
};echo"

<br><b>Montant Total à payer : </b>".$ligne[2]." DA

</td>

<td align=center>
<div id='aj_panier'><a href=\"#\" onClick=\"confirme('".$ligne[0]."')\" >Annuler Commande</a>
</div>";
echo"</td></tr>
</table>";
echo"";
echo"<HR>";

$i=$i+1;

}

$req=mysql_query("select * from 'commande' where ((id_client='$e') && (valid_cmd='1'))")or die (mysql_error());
$i=0;

while ($i<mysql_num_rows($req))
{
$ligne=mysql_fetch_row($req);
echo"
<table class='affich' align='center' cellspacing='1' >
<tr>
<td width=70%>
<b>Numéro commande :</b> ".$ligne[0]."
";$r=mysql_query("select * from 'client' where id_clientt=".$ligne[0]."");
$li=mysql_fetch_row($r);
echo"
<br><b>Nom client : </b>".$li[1]."
<br><b>Prénom client : </b>".$li[2]."<br>

<br><b>Quantité X Prix U</b> | <b>Nom Produit</b> <br><br>
";

$az=mysql_query("select * from 'commande_piece' where num_cmd=".$ligne[0]."");
$k=0;
while ($k<mysql_num_rows($az))
{
$zz=mysql_fetch_row($az);

$produit=mysql_query("select * from 'produit' where num_p=".$zz[1]."");

$pro=mysql_fetch_row($produit);
echo "(".$zz[3]." X ".$pro[4]." DA) -------- ".$pro[1]."<br>";

$k=$k+1;
};echo"

<br><b>Montant Total à payer : </b>".$ligne[2]." DA

</td>
<td align=center>
<div id='commande_OK'><a>Commande Validée</a>
</div></td>
</tr>
</table>";
echo"";
echo"<HR>";

$i=$i+1;

}

$req=mysql_query("select * from 'commande' where ((id_client='$e') && (valid_cmd='-1'))")or die (mysql_error());
$i=0;

while ($i<mysql_num_rows($req))
{
$ligne=mysql_fetch_row($req);
echo"
<table class='affich' align='center' cellspacing='1' >
<tr>
<td width=70%>
<b>Numéro commande :</b> ".$ligne[0]."
";$r=mysql_query("select * from 'client' where id_client=".$ligne[0]."");
$li=mysql_fetch_row($r);
echo"
<br><b>Nom client : </b>".$li[1]."
<br><b>Prénom client : </b>".$li[2]."<br>

<br><b>Quantité X Prix U</b> | <b>Nom Produit</b> <br><br>
";

$az=mysql_query("select * from 'commande_piece' where num_com=".$ligne[0]."");
$k=0;
while ($k<mysql_num_rows($az))
{
$zz=mysql_fetch_row($az);

$produit=mysql_query("select * from 'piece' where num_piece=".$zz[1]."");

$pro=mysql_fetch_row($produit);
echo "(".$zz[3]." X ".$pro[4]." DA) -------- ".$pro[1]."<br>";

$k=$k+1;
};echo"

<br><b>Montant Total à payer : </b>".$ligne[2]." DA

</td>
<td>
<div id='commande_Non'><a>Commande Rejetée<br>
Veuillez contacter le vendeur</a>
</div>
</td></tr>
</table>";
echo"";
echo"<HR>";

$i=$i+1;

}

mysql_free_result($req);

mysql_close($connection); //Puis on se déconnecte
?>
</p>
</td>
</tr>
<tr>
<td height="-1" colspan="2"><p>  </p>
</td>
</tr>
<tr>
<td width="241" height="0"> </td>
<td width="374"> </td>
</tr>
<tr>

<td width="241" height="2"> </td>
<td> </td>
</tr>
<tr>
<td width="241" height="5"> </td>
<td> </td>
</tr>
<tr>
<td width="241" height="13"> </td>
<td> </td>
</tr>
<tr>
<td width="241" height="61"> </td>
<td> </td>
</tr>
</table>
</div></td>
</tr>
</table></div>
</body>
</html>
<?php
}else{header("Location: authentification_client.php");}
?>

3 réponses

  1. Bonjour,

    Chez mois ça fonctionne.
    Si $_SESSION['log_cli'] existe il m'affiche "espace commande" sir la variable n'existe pas il me renvoi sur le fichier "authentification_client.php"

    Cordialement
    1. mais moi il affiche une page vide
    2. c bon le problème c'était dans le nom de la variable session...merci
    3. slt pour faire un panier d'achat pour la vente de véhicule ......j'ai 3 sorte de client ceux qui ont de la licence moudjahid ,ceux qui ont de l'anseig et simple client comment faire le test pour afficher le prix dans le panier merci
  2. le problème vient peut être du fichier authentification_client.php
    a la place de header("Location: authentification_client.php");
    saisir echo "OK";

    est-ce qu'il affiche OK ?
    1. ah finalement il n'affiche pas le nom et le prénom du client pour quoi???merci