D
derkomai
ex membre
voilà, le script qui suit me permet d'afficher les commandes en cours. L'affichage se fait gràce à ma table neworder mais lorsque je dois afficher le nom du client ou le nom de la socièté il ne veux pas me les afficher les 2 en même temps. Soit j'ai droit au nom des particuliers soit au noms des sociètés?
<html>
<head>
<title>In Order</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="98%" border="1" align="center" cellspacing="1" cellpadding="3">
<tr bordercolor="#FFFFFF">
<td>
<table width="95%" border="1" align="center" cellspacing="0" cellpadding="3">
<tr bgcolor="#F0F0F0" bordercolor="#FFFFFF">
<td width="19%"><div align="center"><strong>Client</strong></div></td>
<td width="8%"><div align="center"><strong>sku</strong></div></td>
<td width="59%"><div align="center"><strong>Description</strong></div></td>
<td width="6%"><div align="center"><strong>Prix</strong></div></td>
<td width="8%"><div align="center"><strong>Date</strong></div></td>
</tr>
<?
require 'config.php';
$sql = 'SELECT * FROM neworder ORDER BY date DESC';
$result = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($row=mysql_fetch_array($result)) {
$proquery="select description from produit where sku='".$row["sku"]."'";
$proresult=mysql_query($proquery);
$userquery="select nom, prenom from client where user_id='".$row["user_id"]."'";
$userresult=mysql_query($userquery);
$user=mysql_fetch_array($userresult);
$socquery="select nomsoc, perscont from societe where soc_id='".$row["soc_id"]."'";
$socresult=mysql_query($socquery);
$soc=mysql_fetch_array($socresult);
if($pro=mysql_fetch_array($proresult)) {
echo "<tr bordercolor=\"#FFFFFF\" bgcolor=\"#DEDFD7\">";
echo "<td ><font size=\"2\">".$user["nom"]." ".$user["prenom"]."</font></td> ";
//echo "<td ><font size=\"2\">".$soc["nomsoc"]." - ".$soc["perscont"]."</font></td> ";
echo " <td ><font size=\"2\">".$row["sku"]."</font></td> ";
echo " <td ><font size=\"2\">".$pro["description"]."</font></td> ";
echo " <td ><font size=\"2\">".$row["price"]."</font></td> ";
$date = $row["date"];
sscanf($date, "%4s-%2s-%2s", &$an, &$mois, &$jour);
echo " <td ><font size=\"2\">".$jour.'/'.$mois.'/'.$an."</font></td> ";
echo "</tr>";
}
}
?>
</table>
</table>
</body>
</html>
merci d'avance
<html>
<head>
<title>In Order</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="98%" border="1" align="center" cellspacing="1" cellpadding="3">
<tr bordercolor="#FFFFFF">
<td>
<table width="95%" border="1" align="center" cellspacing="0" cellpadding="3">
<tr bgcolor="#F0F0F0" bordercolor="#FFFFFF">
<td width="19%"><div align="center"><strong>Client</strong></div></td>
<td width="8%"><div align="center"><strong>sku</strong></div></td>
<td width="59%"><div align="center"><strong>Description</strong></div></td>
<td width="6%"><div align="center"><strong>Prix</strong></div></td>
<td width="8%"><div align="center"><strong>Date</strong></div></td>
</tr>
<?
require 'config.php';
$sql = 'SELECT * FROM neworder ORDER BY date DESC';
$result = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($row=mysql_fetch_array($result)) {
$proquery="select description from produit where sku='".$row["sku"]."'";
$proresult=mysql_query($proquery);
$userquery="select nom, prenom from client where user_id='".$row["user_id"]."'";
$userresult=mysql_query($userquery);
$user=mysql_fetch_array($userresult);
$socquery="select nomsoc, perscont from societe where soc_id='".$row["soc_id"]."'";
$socresult=mysql_query($socquery);
$soc=mysql_fetch_array($socresult);
if($pro=mysql_fetch_array($proresult)) {
echo "<tr bordercolor=\"#FFFFFF\" bgcolor=\"#DEDFD7\">";
echo "<td ><font size=\"2\">".$user["nom"]." ".$user["prenom"]."</font></td> ";
//echo "<td ><font size=\"2\">".$soc["nomsoc"]." - ".$soc["perscont"]."</font></td> ";
echo " <td ><font size=\"2\">".$row["sku"]."</font></td> ";
echo " <td ><font size=\"2\">".$pro["description"]."</font></td> ";
echo " <td ><font size=\"2\">".$row["price"]."</font></td> ";
$date = $row["date"];
sscanf($date, "%4s-%2s-%2s", &$an, &$mois, &$jour);
echo " <td ><font size=\"2\">".$jour.'/'.$mois.'/'.$an."</font></td> ";
echo "</tr>";
}
}
?>
</table>
</table>
</body>
</html>
merci d'avance