基本的に、同じテーブルから値IDを取得して、テーブルに挿入したいと思います。
$sql = ("INSERT INTO commande (idfichecmd,idproduit,idclt,qte,datecmd)
(SELECT MAX(idfichecmd)+1 ,'1' AS idproduit ,'$idC' AS idclt ,'$fb' AS qte,'$date' FROM commande),
(SELECT MAX(idfichecmd) ,'2' AS idproduit ,'$idC' AS idclt ,'$g' AS qte,'$date' FROM commande),
(SELECT MAX(idfichecmd) ,'3' AS idproduit ,'$idC' AS idclt ,'$pi' AS qte,'$date' FROM commande),
(SELECT MAX(idfichecmd) ,'4' AS idproduit ,'$idC' AS idclt ,'$ft' AS qte,'$date' FROM commande),
(SELECT MAX(idfichecmd) ,'5' AS idproduit ,'$idC' AS idclt ,'$sd' AS qte,'$date' FROM commande),
(SELECT MAX(idfichecmd) ,'6' AS idproduit ,'$idC' AS idclt ,'$ad' AS qte,'$date' FROM commande),
(SELECT MAX(idfichecmd) ,'7' AS idproduit ,'$idC' AS idclt ,'$vs' AS qte,'$date' FROM commande),
(SELECT MAX(idfichecmd) ,'8' AS idproduit ,'$idC' AS idclt ,'$wi' AS qte,'$date' FROM commande),
(SELECT MAX(idfichecmd) ,'9' AS idproduit ,'$idC' AS idclt ,'$equip' AS qte,'$date' FROM commande),
(SELECT MAX(idfichecmd) ,'10' AS idproduit ,'$idC' AS idclt ,'$fo' AS qte,'$date' FROM commande),
(SELECT MAX(idfichecmd) ,'11' AS idproduit ,'$idC' AS idclt ,'$fh' AS qte,'$date' FROM commande)")or die(mysql_error());
$result = mysql_query($sql) or die("Unable to add commande : ". mysql_error());
mysql_close();
しかし、これは機能しません、誰もが理由を知っていますか?