Erreur sql rock and roll ! - oh la c'est bouillant

hello,

lorsque je valide une commande, cela apparait bien dans mon admin, avec id transaction tout le toutim mais quand je veux imprimer la facture, rien du tout de chez rien du tout ! alors dans les messages d’erreurs j’ai cette chose étrange venue d’un autre monde…

MySQL Error!
Query

		UPDATE 
			kpro_shop_orders 
		SET 
			calculation = 

PUIS LE CODE
:

'<style type="text/css">
body{background-color:#ffffff;font-family:Verdana,Arial;color:#000000;font-size:11px}
td,th{font-family:Verdana,Arial;color:#000000;font-size:11px}
</style>
<strong>Merci beaucoup de votre commande !</strong><br />

Cette derniére va passer trés rapidement en traitement.
<br />
<br />
Veuillez considérer cette facture comme acquitée en cas de réglement intégral du produit.<br />
Pour les réglements par virement, nos coordonées bancaires se trouvent en bas du document.<br /> 
<br /><br />
<table width="100%"  border="0" align="center" cellpadding="3" cellspacing="0">
  <tr>
    <td style="border-bottom:2px solid #000000;background-color:#ffffff" colspan="7"><h2>Facture</h2></td>
  </tr>
  <tr>
    <td colspan="7" style="padding:10px;"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="33%" valign="top"><strong>Numéro de facture:</strong> 16<br />
            <strong>Numéro client:</strong> 1<br />
  	<strong>Date de facture:</strong> 16.01.2006
  	<br />
            <br />


Monsieur<br />
sdfsd fsdfsdf <br />
45 sdfsdfsdf<br />
4545445 sdfsdf
</td>
          <td width="33%" valign="top"><strong>Adresse de livraison</strong><br />



Monsieur<br />
sdfsd fsdfsdf <br />
45 sdfsdfsdf<br />
4545445 sdfsdf

    </td>
          <td width="33%" valign="top"><div align="right"><img src="http://www.societe test/templates/standard_blau/img/page/logo.gif" alt="" border="0" /><br />societe test<br />
45, Rue des NTIC<br />
51000 REIMS -FRANCE<br />
tel.: +33 (0) 1111111111<br />
fax.: +33 (0) 1111111111 <br />

</div></td>
        </tr>
      </table>
   <br />
	</td>
  </tr>
  <tr>
  
    <th style="border-bottom:1px solid #000000;background-color:#EBEBEB">Article</th>
    <th style="border-bottom:1px solid #000000;background-color:#EBEBEB">Options</th>
    <th style="border-bottom:1px solid #000000;background-color:#EBEBEB">Prix unitaire</th>
    <th style="border-bottom:1px solid #000000;background-color:#EBEBEB">Prix des options</th>
    <th style="border-bottom:1px solid #000000;background-color:#EBEBEB">Total</th>
    <th style="border-bottom:1px solid #000000;background-color:#EBEBEB">Taxes (%)</th>
    <th style="border-bottom:1px solid #000000;background-color:#EBEBEB">Nombre</th>
  </tr>
     <tr style="background-color:#EBEBEB">
  
    <td valign="top"><strong>Coordonnées de 600 Entreprises d'Industrie du Bois pour la région Rhône Alpes</strong> <br />      Art.N°.: 000-000-625<br />
	
Dispo immédiate en téléchargement

  </td>
    <td valign="top" nowrap="nowrap"> </td>
    <td valign="top" nowrap="nowrap">50,00 &euro;</td>
    <td valign="top" nowrap="nowrap">0,00</td>
    <td valign="top" nowrap="nowrap">50,00 &euro;</td>
    <td valign="top" nowrap="nowrap">19,60</td>
    <td valign="top" nowrap="nowrap"> 1 </td>
  </tr>
    <tr>
    <td colspan="7" class="shop_hr"><div align="right"> </div></td>
  </tr>
  <tr>
    <td colspan="7" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td valign="top"><div><strong>Poids</strong></div>
            <em>environ. 0,000 KG</em>
            <input type="hidden" name="weight"  value="0" />
             <br />
               </td>
          <td valign="top"><br />
            <div align="right">
              <table  border="0" cellspacing="0" cellpadding="0">
                
        <tr>
                  <td>Sous-total:</td>
                  <td><div align="right">       50,00 &euro; </div></td>
                </tr>
    
        
    <!-- NEU 4.4! -->
                <tr>
                  <td>Cout méthode de paiement:</td>
                  <td><div align="right">0,00 &euro;</div></td>
                </tr>
    <!-- NEU 4.4! -->
    
    
                <tr>
                  <td>Frais d'expédition:</td>
                  <td><div align="right"> 0,00 &euro; </div></td>
                </tr>
    
        
                    <tr>
                  <td>Taxes:</td>
                  <td><div align="right"> 7,98 &euro; </div></td>
                </tr>
                    
                <tr>
                  <td style="border-bottom:2px solid #000000;border-top:2px solid #000000">Montant Total facture:</td>
                  <td style="border-bottom:2px solid #000000;border-top:2px solid #000000"><div align="right"> <strong>50,00 &euro;</strong><br />
                    </div></td>
                </tr>
                
              </table>
            </div></td>
        </tr>
      </table>
   <br />
   <strong>Méthode de paiement:</strong> Par chéque ou virement
   <br />
      <br />
   <br />
   </td>
  </tr>
</table>
<strong>Coordonées bancaires</strong><br />
BANQUE POPULAIRE CHAMPAGNE<br />
Compte N°: 54646546<br />
Code Guichet: 47205/31073
Code Etablissement.: 1313138790
<br />
SWIFT:FR5454545454545454545<br />
Bénéficiaire:societe test',
    calculation2 = '
Merci beaucoup de votre commande !

Cette derniére va passer trés rapidement en traitement.


Veuillez considérer cette facture comme acquitée en cas de réglement intégral du produit.
Pour les réglements par virement, nos coordonées bancaires se trouvent en bas du document. 

=====================================================================
societe test
45, Rue des NTIC
51000 REIMS -FRANCE
tel.: +33 (0) 1111111111
fax.: +33 (0) 1111111111 


Facture
=====================================================================
Numéro de facture:         16
Numéro client:            1
Date de facture:       16.01.2006

Monsieur
sdfsd fsdfsdf 
45 sdfsdfsdf
4545445  sdfsdf

Adresse de livraison
---------------------------------------------------------------------
Monsieur
sdfsd fsdfsdf 
45 sdfsdfsdf
4545445 sdfsdf
---------------------------------------------------------------------  

       
Article
Pos. 1
Coordonnées de 600 Entreprises d'Industrie du Bois pour la région Rhône Alpes
Art.N°.: 000-000-625 

 

Dispo immédiate en téléchargement

Prix unitaire   50,00 &euro;
Prix des options  0,00
Total  50,00 &euro;
Taxes (%)  19,60
Nombre  1


---------------------------------------------------------------------  
Poids:  environ. 0,000 KG

Cout méthode de paiement:  0,00 &euro;
Sous-total: 50,00 &euro;
Frais d'expédition: 0,00 &euro;
Taxes: 7,98 &euro;
================================================================
Montant Total facture: 50,00 &euro;
================================================================

Méthode de paiement:Par chéque ou virement


Coordonées bancaires
BANQUE POPULAIRE CHAMPAGNE
Compte N°: 54646546
Code Guichet: 47205/31073
Code Etablissement.: 1313138790

SWIFT:FR5454545454545454545
Bénéficiaire:societe test'

puis pour terminer

WHERE
control = ‘J1GFX3A2_16012006’

Error
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Industrie du Bois pour la région Rhône Alpes</strong> <br />

Page
http://www.societe test/index.php?p=shop&action=showbasket&ok=1&bid=MTY=&pm=1&area=1

alors la c’est le bouquet ! :??:

Heuuu, plutôt que de nous balancer le code html généré (qui soit dit entre nous ne nous sert à rien ici :wink: ), pourrais-tu nous donner le code php en indiquant la requete qui ne fonctionne pas comme tu voudrais???

Bonjour

4400 excuses… voici le code :

<?php

if(!defined("SHOP")) exit;
	$orders = array();
	$sql = $db->Query("SELECT 
  a.*,
  b.multiorder_deny
	FROM 
  ".PREFIX."_shop_cart as a,
  ".PREFIX."_shop_articles as b
	WHERE 
  a.ordernumber = '".escs($_COOKIE['ordernumber'])."' AND 
  b.artnumber =  a.artnumber
	");
	
	$num = $sql->numrows();
	$articles_t = array();
	while($row = $sql->fetchrow()){

	// =======================================================================
	// variantes pour les options
	//  exemple : le client prend une option a x euros en plus
	//  exemple : le client prend une option a x euros en moins par ex  6 mois au lieu de 12
	// =======================================================================
	$ex = @explode("||", $row->extras_string);
	
	if($row->extras_string!=''){
  foreach($ex as $extra){
  $operand = "";
  $sql_ex = $db->Query("SELECT  math_operant,math_value FROM ".PREFIX."_shop_artoptions WHERE id = '$extra'");
  $row_ex = $sql_ex->fetchrow();
    $operand = ($row_ex->math_operant=='plus') ? '+' : '-';
    if($operand=='+'){ 
    	// ici on ajoute
    	$extra_price_string += $row_ex->math_value;
    	} else { 
    	// ici on enléve
    	$extra_price_string -= $row_ex->math_value;
    }
    unset($operand);
  }
}
	$q = "
  SELECT
  	a.multiorder_deny, a.icon, a.id, a.articlecat, a.artnumber, a.price, a.title, a.descr, a.icon, a.ustzone, a.show_st, a.weight,
  	u.id, u.name, u.val
  FROM 
  	".PREFIX."_shop_articles AS a,
  	".PREFIX."_shop_ustzone AS u
  WHERE  
  	a.artnumber='$row->artnumber' AND 
  	u.id = a.ustzone 
  ";
  
  
	$sql2 = $db->Query($q);
	$row2 = $sql2->fetchrow();

	
  
	$sql3 = $db->Query("
  SELECT 
  	newprice,
  	extras_string
  FROM
  	".PREFIX."_shop_cart 
  WHERE 
  	ordernumber='".$_COOKIE['ordernumber']."'
  ");
	
	$sql4 = $db->Query("SELECT val FROM ".PREFIX."_shop_ustzone WHERE id='$row2->ustzone'");
	$row4 = $sql4->fetchrow();

  
  
  
  // =======================================================================
  // prix y compris les options
  // =======================================================================
  $row->extra_price = ($extra_price_string * $row->artamount) + new_price($row2->price,$row2->val) * ($row->artamount);
  
  
  // =======================================================================
  // prix
  // =======================================================================
  $newprices = array();
  $sql_stprices = $db->Query("SELECT * FROM ".PREFIX."_shop_stprices WHERE artnumber='$row->artnumber' ");
  	while($row_stprice = $sql_stprices->fetchrow()){
    if( ($row->artamount >= $row_stprice->from_a) && ($row->artamount <= $row_stprice->to_a) )
    {
    	if($row->artnumber!=0) $newprice = $row_stprice->newprice;
    } 
  }
  
  if(file_exists(BASEDIR . "/uploads/shop/icons/$row2->icon")){
  	$row->image = $row2->icon;
  }
  #echo BASEDIR . "/uploads/shop/icons/$row2->icon";
  
  $row->weight = $row2->weight/1000;
  $row->title = $row2->title;
  $row->descr = $row2->descr;
  $articles[] = $row2->artnumber;
  
  array_push($articles_t,$row->artnumber);
  
  // =======================================================================
  //  prix unitaires...
  // =======================================================================
  
  $row->price_allone = $row2->price;
  $ep = ($newprice > 0) ? $newprice : $row->price_allone;
  $row->price_simple = new_price($ep,$row2->val);
  $row->var_price = new_price($extra_price_string,$row2->val);
  $row->price_allone = new_price($ep,$row2->val) + new_price($extra_price_string,$row2->val); // EINZELPREIS
  $row->summ_ex_var = $row->price_allone; // EINZELPREIS + VARIANTEN
  $row->pnetto = cart_endprice($row->artamount * $row->price_allone,$row2->val); // GESAMTPREIS

  // =======================================================================
  //  taxes
  // =======================================================================
  $row->ust = (USTP==1) ? $row4->val : 0;
  if(UST_INCLUDED==1){
  	// quand taxes incluses
  	$row->ust_ovall = ($row->price_allone * $row->artamount) - sub_ust($row->price_allone * $row->artamount,$row4->val);
  } else {
  	// quand hors taxes
  	$row->ust_ovall = (add_ust($ep,$row4->val) * $row->artamount) - add_ust($row->price_allone * $row->artamount,$row4->val);
  }
  
  $weight_simple = ($row2->weight/1000)*$row->artamount;
  
  
  array_push($orders, $row);
  
  
  // les totaux
  $endpreis += $row->pnetto;
  $ust_ovall += $row->ust_ovall;
  $weight += $weight_simple;
  unset($newprice);
  unset($row2->artnumber);
  unset($row->price_simple);
  unset($row->extra_price);
  unset($extra_price_string);
  unset($row->price_simple);
  unset($row->var_price);
  unset($row_stprice);
  unset($row->ust_ovall);
  
	}

	// considération du pods et options expéditions
	if($weight > 0){
  $shop_shipper = array();
  $sql = $db->Query("SELECT * FROM ".PREFIX."_shop_shipper WHERE enabled='1'");
  while($row_shipper = $sql->fetchrow()){
  	
  	
  	$sql_s = $db->Query("SELECT * FROM ".PREFIX."_shop_shipping_temp WHERE ordernumber='$_COOKIE[ordernumber]'");
  	$row_s = $sql_s->fetchrow();
  	$shipper_chosen = $row_s->shipper;
  	
  	// si une métode d'expédition standars a été choise
  	if( ($row_shipper->default_shipper == 1) && ($shipper_chosen=='') ){
    $row_shipper->checked_shipper = $row_shipper->shipper_id;
  	} else {
    $row_shipper->checked_shipper = $shipper_chosen;
  	}
  	
  	array_push($shop_shipper,$row_shipper);
  }
  
  //calcul des couts

  if($row_s->shipper==''){ 
  $sql = $db->Query("SELECT * FROM ".PREFIX."_shop_shipper WHERE enabled='1' AND default_shipper='1'");
  $row = $sql->fetchrow();
  $sql->close();
  switch($weight){
  	case $weight <= 5 && ($weight > 0 || $weight > 0.000 || $weight != 0.000) :
    	$c = $row->si_fi;
    	break;
    	
    	case $weight <= 10 && $weight >= 5 :
    	$c = $row->fi_te;
    	break;
    	
    	case $weight <= 20 &&  $weight >= 10 :
    	$c = $row->te_tw;
    	break;
    	
    	case $weight >= 20 :
    	$c = $row->max_cost;
    	break;
  }
  
  // frais forfaitaires
  if($row->pauschal > 0) $c = $row->pauschal;

  $sql_c = $db->Query("SELECT id,shipper FROM ".PREFIX."_shop_shipping_temp WHERE ordernumber='$_COOKIE[ordernumber]'");
  $num_c = $sql_c->numrows();
  $row_c = $sql_c->fetchrow();
  
  if( ($_COOKIE['ordernumber']!='') && ($num_c < 1) ){
  $q = "
  	INSERT INTO ".PREFIX."_shop_shipping_temp (
    id,
    summe,
    ordernumber,
    shipper,
    uid,
    overall,
    ordertime,
    deduction
  	) VALUES (
    '',
    '$c',
    '$_COOKIE[ordernumber]', 
    '$row_c->shipper_id', 
    '".UID."',
    '$endpreis',
    '".time()."',
    '".DEDUCTION."'
  	)";
  
  $sql = $db->Query($q);
	
  	}
    else {
    $sql = $db->Query("
    UPDATE 
    	".PREFIX."_shop_shipping_temp 
    SET 
    	summe='$c', 
    	shipper='$row->shipper_id', 
    	overall='$endpreis', 
    	ordertime='".time()."' ,
    	deduction = '".DEDUCTION."'
    WHERE 
    	ordernumber='".escs($_COOKIE['ordernumber'])."'
    	");
  	}
  }
  // options expeditions
  $tmpl->assign('shop_shipper', $shop_shipper);
	}
	
	// coupons de reduc
	if(!empty($_REQUEST['coupon']) || $_COOKIE['coupon_c']!=''){
  $coup = ($_COOKIE['coupon_c']!='') ? $_COOKIE['coupon_c'] : $_REQUEST['coupon'];
  $sql = $db->Query("SELECT id,couponcode,amount FROM ".PREFIX."_shop_coupons WHERE couponcode='".escs($coup)."' and redeemed < 1");
  
  $row_coupon = $sql->fetchrow();
  if($row_coupon != ''){
  	$sql = $db->Query("UPDATE ".PREFIX."_shop_shipping_temp SET coupon='$row_coupon->id', coupon_amount = '$row_coupon->amount',  deduction='".DEDUCTION."'");
  	@setcookie("coupon_c", $coup, time()+3600);
  }
	}
	
	$endpreis_pre = $endpreis;
	$ust_ovall_pre = $ust_ovall;
	
	$sql = $db->Query("SELECT coupon_amount,summe, deduction FROM ".PREFIX."_shop_shipping_temp WHERE ordernumber = '".escs($_COOKIE['ordernumber'])."'" );
	$row_cp = $sql->fetchrow();
	if($row_cp->coupon_amount>0){
  
  $endpreis_in_coupon = $endpreis;
  $endpreis = $endpreis - $row_cp->coupon_amount;
  $ust_ovall = $endpreis - sub_ust($endpreis,$row4->val);
  $tmpl->assign('coupon_amount', $row_cp->coupon_amount);
  $tmpl->assign('endpreis_in_coupon', $endpreis_in_coupon);
	}
	
	if( ($row_cp->coupon_amount!='' && $row_cp->coupon_amount!='0.00') && ($row_cp->coupon_amount >= $endpreis_in_coupon)){
  $endpreis = $endpreis_pre;
  $ust_ovall = $ust_ovall_pre;
  $tmpl->assign('coupon_bigger_t_store', '1');
  $tmpl->assign('coupon_amount', "");
  $tmpl->assign('endpreis_in_coupon', "");
	} 
	//LA SOMME TOTALE

	$endpreis = $endpreis;
	$all = $endpreis + $row_cp->summe;
	$decu_amount = $all - deduction($all);

	if($decu_amount < $endpreis) {
  $tmpl->assign('decuamount', $decu_amount);
  define("DECU", $decu_amount);
  $ust_ovall = $ust_ovall - ($decu_amount - sub_ust($decu_amount, $row4->val));
  }
	
	
	$temppreis = $endpreis;
	$tmpl->assign('zwipreis', $endpreis);
	$tmpl->assign('endpreis', $endpreis); 
	$tmpl->assign('ust_ovall', $ust_ovall);
	$tmpl->assign('weight', $weight); // poids
	$tmpl->assign('weight_cost', $c); // Frais d'expédition
	
	
	$tmpl->assign('articles', @implode(',',$articles_t));
	$tmpl->assign('ust_mwst', $ust_s);
	$tmpl->assign('overall', $ov_all);
	$tmpl->assign('count_orders', count($orders));
	$tmpl->assign('order_id', $_COOKIE['ordernumber']);
	$tmpl->assign('shop', $shop);
	$tmpl->assign('orders', $orders);
?>

jje le retourne dans tous les sens, j’ai déja du mal a comprendre, mais je crois que je vais aller chercher du DIANTALVIC !