Bonjour voila un script que j ai crée , mais j ai un petit soucis avec , j'aimerais quand mon stock restant arrive a Zero de rendre mon produit invisible a la commande. mais j ai une petite sur pas grave comme erreur mais je la voix pas??? sauirez vous m'aider .MERCI
<html>
<head>
<title>##############-STOCK-##############</title>
</head>
<?php require('config.php');
$total_total_q = 0;
$sql = "SELECT id_pro, quantite_prod FROM $table_produit where id_pro='$article'";
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
while ($row = mysql_fetch_array($req)) {
$article = $row['id_pro'];
$quantite = $row['quantite_prod'];
}
$total_total_q += $quantite;
function date_sortie($article)
{
$req = mysql_query("select date_com from $table_commande where id_com=\"$id\"");
$date = @mysql_result($req,0,"date_com");
$date = ereg_replace('^([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})$', '\\3/\\2/\\1', $date);
return $date;
}
$total_produit_sortie = 0;
$req = mysql_query("select id_com,id_det,id_pro,quantite from $table_detail where id_pro=\"$article\" order by id_com desc");
while($ligne = mysql_fetch_array($req))
{
$article = $ligne["id_pro"];
$quantite = $ligne["quantite"];
$id_com = $ligne["id_com"];
$date = date_sortie($id_com);
$id_com = sprintf("%08s",$id_com);;
$total_produit_sortie += $quantite;
}
$quantite_restante = $total_total_q-$total_produit_sortie;
?>
<table border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="<? echo"$barre1"; ?>" width="200">
<tr>
<td bgcolor="<? echo"$barre1"; ?>" align="center" width="20%"><b>Quantité</b></td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center" width="20%"><?php echo("$quantite_restante"); ?></td>
</tr>
</table>
<br>
<?php
$sql = "UPDATE $table_produit SET actif_prod='$visible' where id_pro='$article'";
mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());
if ($quantite_restante == 0)
{
$visible="0";
}
else
{
$visible="1";
}
?>