Bonjour voici un petit script pour gérer mon stock mais j'aimerais changer la valeur du stock dans ma table??? et cela ne fonction pas??? je vois pas pq seriez vous m'aider please. 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,quantite from $table_detail where id_pro=\"$article\" order by id_com desc");
while($ligne = mysql_fetch_array($req))
{
$article = $ligne["id_pro"];
$quantite_detail = $ligne["quantite"];
$id_com = $ligne["id_com"];
$date = date_sortie($id_com);
$id_com = sprintf("%08s",$id_com);;
$sql = "UPDATE $table_produit SET quantite_prod='$quantite_restante' where id_pro='$article'";
mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());
$total_produit_sortie += $quantite_detail;
$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>


