• Home
  • Forum
  • Fare Web
  • PHP

Problema array_key_exists!

  • Creatore Discussione Creatore Discussione Fabrizio Villa
  • Data di inizio Data di inizio 18 Feb 2013
Prec.
  • 1
  • 2
  • 3
  • 4
  • 5
Succ.
Primo Prec. 3 di 5 Succ. Ultimo
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 1 Mar 2013
  • #41
ma è quello che ho fatto, però non conoscendo bene, anzi molto male, il php non riesco a capire dove sia il problema.
Per questo ho chiesto aiuto a voi esperti!
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 1 Mar 2013
  • #42
Ecco l'originale:
PHP:
<?php
/*
	Page : panier_valider.php
				Page qui envoie et confirme la commande
*/
$NumeroCommande = date("Gisdm")." - ".date("y");
$TotalCommande = 0;
//On regarde si le paramètre sont correcte
if (isset($_SESSION["commande"]["prod"])){
	if (isset($_POST["tnom"]) && isset($_POST["ttel"])){
		$headers ='From: "Au petit comestible"<webmaster@aupetitcomestible.net>'."\n";
		$headers .='Content-Type: text/html; charset="iso-8859-1"'."\n";
		$headers .='Content-Transfer-Encoding: 8bit';			
		$cles = array_keys($_SESSION["commande"]["prod"]);			 
		
		if (isset($_POST["tremarques"]))
			$remarques = $_POST["tremarques"];
		else
			$remarques = 'Aucune.';
		//Numéro de commande : '.$NumeroCommande.'<br />	 
		$messageclients = '<html>
						<head>
							<title>
								Votre Commande
							</title>
						</head>
						<body>
						<p>Bonjour '.$_POST["tnom"].', votre commande a bien été prise en compte : <br /><br />
							Téléphone : '.$_POST["ttel"].'<br />
							Heure de passage : '.$_POST["theureh"].'h'.$_POST["theurem"].'<br/>
							
		       	   		</p>
						<table width="600">
						  <caption style="font-size:20px;color:#000000;font-weight:bold;">Commande</caption>
						  <tr>
							 <th style="background:#FFFFFF;color:#000000;">Produit</th>
							 <th style="background:#FFFFFF;color:#000000;">Prix</th>
							 <th style="background:#FFFFFF;color:#000000;">Quantité</th>
							 <th style="background:#FFFFFF;color:#000000;">Sous total</th>
						  </tr>	';	
		$tot = 0;
		foreach($cles as $i){
			if (array_key_exists($i, $_SESSION["commande"]["prod"]))
			{
				$_SESSION["commande"]["prix"][$i] = str_replace(",", ".", $_SESSION["commande"]["prix"][$i]);
				$soustot = (float)$_SESSION["commande"]["prix"][$i] * (float)$_SESSION["commande"]["quantite"][$i];
				$_SESSION["commande"]["prix"][$i] = str_replace(".", ",", $_SESSION["commande"]["prix"][$i]);
				
				$messageclients .=  '<tr>
				              	<td style="border:#000000 solid 1px;">
									'.stripslashes($_SESSION["commande"]["prod"][$i]).'
								</td>
								<td style="text-align:right;border:#000000 solid 1px;">
									'.$_SESSION["commande"]["prix"][$i].' CHF
								</td>
								<td style="text-align:center;border:#000000 solid 1px;">
									'.$_SESSION["commande"]["quantite"][$i].'
								</td>
								<td style="text-align:right;border:#000000 solid 1px;">
									'.number_format($soustot, 2, ',', ' ').' CHF
								</td>								
							  </tr>';
				$tot += $soustot;
			}	   
		}
		$messageclients .= '</table><div style="text-align:right;margin-top:10px;width:600px;color:#000000;font-size:18px;">
						Total : '.number_format($tot, 2, ',', ' ').' CHF</div>
						<br /><br />
						Remarques : '.$remarques.'
						</body></html>';
		//Numéro de commande : '.$NumeroCommande.'<br />										  
		$message = '<html>
						<head>
							<title>
								Nouvelle commande
							</title>
						</head>
						<body>
						<p>
							Nom : '.$_POST["tnom"].'<br /> 
							Téléphone : '.$_POST["ttel"].'<br />
							Email : '.$_POST["tmail"].'<br >
							Heure de passage : '.$_POST["theureh"].'h'.$_POST["theurem"].'<br/>
							Remarques : '.$remarques.' <br />
							
		       	   		</p>
						<table width="600">
						  <caption style="font-size:20px;color:#000000;font-weight:bold;">Commande</caption>
						  <tr>
						  	 <th style="background:#FFFFFF;color:#000000;font-size:12px;">Quantité</th>
							 <th style="background:#FFFFFF;color:#000000;font-size:12px;">Produit</th>
							 <th style="background:#FFFFFF;color:#000000;font-size:12px;">Prix</th>
							 <th style="background:#FFFFFF;color:#000000;font-size:12px;">Sous total</th>
						  </tr>';
		$tot = 0;
		foreach($cles as $i){
			if (array_key_exists($i, $_SESSION["commande"]["prod"]))
			{
				$_SESSION["commande"]["prix"][$i] = str_replace(",", ".", $_SESSION["commande"]["prix"][$i]);
				$soustot = (float)$_SESSION["commande"]["prix"][$i] * (float)$_SESSION["commande"]["quantite"][$i];
				$_SESSION["commande"]["prix"][$i] = str_replace(".", ",", $_SESSION["commande"]["prix"][$i]);
				
				$message .=  '<tr>
								<td style="border:#000000 solid 1px;text-align:center;">
									'.$_SESSION["commande"]["quantite"][$i].'
								</td>
				              	<td style="border:#000000 solid 1px;">
									'.stripslashes($_SESSION["commande"]["prod"][$i]).'
								</td>
								<td style="text-align:right;border:#000000 solid 1px;">
									'.$_SESSION["commande"]["prix"][$i].' .Sfr
								</td>
								<td style="text-align:right;border:#000000 solid 1px;">
									'.number_format($soustot, 2, ',', ' ').' CHF
								</td>								
							  </tr>';
				$tot += $soustot;
			}	   
		}
		$message .= '</table><div style="text-align:right;margin-top:10px;width:600px;color:#000000;font-size:18px;">
						Total : '.number_format($tot, 2, ',', ' ').' CHF</div></body></html>';
			
		$mail = $params["mail"];
		
		if(@mail($mail, 'Commande Au petit comestible', $message, $headers) && @mail($_POST["tmail"], 'Commande Au petit comestible', $messageclients, $headers))
		{
			  echo '<br />Commande envoyée! Un Email de confirmation a été envoyé à l\'adresse : '.$_POST["tmail"].'.<div class="spa"></div>';

			  $sqlcommande = "INSERT INTO tstat (idstat, datecommande, champtype, description, prix) VALUES "; 
			  			  
			  foreach($cles as $i)
			  {
			  	if (array_key_exists($i, $_SESSION["commande"]["type"]) && $_SESSION["commande"]["type"] != NULL)
			  	{
			  		for ($j = 0; $j < $_SESSION["commande"]["quantite"][$i]; $j++)
			  		{		  			
				  		$desc = str_replace("<br />", " - ", $_SESSION["commande"]["prod"][$i]);
				  		$desc = strip_tags($desc);			  		
				  		$sqlcommande .= " ('', '".date("Y-m-d")."', '".$_SESSION["commande"]["type"][$i]."', '".addslashes($desc)."',".number_format((float)$_SESSION["commande"]["prix"][$i], 2, '.', ' ').")"; 		  
				  	}
			  	 }
			  }
			  
			  $sqlcommande = substr($sqlcommande, 0, strlen($sqlcommande)-1);
			  $sqlcommande .= ";";			  		  
			  mysql_query($sqlcommande) or die ("Erreur SQL > ".$sqlcommande."<br />".mysql_error()); 	
 
			  unset($_SESSION["commande"]);
		}
		else
			echo '<br />Erreur répéter l\'opération.<div class="spa"></div>';
	}
}

?>
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 1 Mar 2013
  • #43
Io ho aggiunto il form PAYPAL e un altro form per la mailing-list.
Ma se li tolgo il problema permane...aaaaaahhhh!!!!
 

borgo italia

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
4 Feb 2008
16.044
150
63
PR
www.borgo-italia.it
  • 1 Mar 2013
  • #44
ciao
ma l'originale funzionava?
sei sicuro che avendo tolto quello che hai messo di non aver tolto qulcos'altro? alle volte basta una quisquiglia e tutto va in pallino
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 1 Mar 2013
  • #45
Forse ho piazzato male i form?
PHP:
<?php
/*
        Page : panier_valider.php
                                Page qui envoie et confirme la commande
*/      
$NumeroCommande = date("Gisdm")." - ".date("y");
$TotalCommande = 0;
//On regarde si le paramètre sont correcte
if (isset($_SESSION["commande"]["prod"])){
        if (isset($_POST["tnom"]) && isset($_POST["ttel"])){
                $headers ='From: "Au petit comestible"<webmaster@aupetitcomestible.net>'."\n";
                $headers .='Content-Type: text/html; charset="iso-8859-1"'."\n";
                $headers .='Content-Transfer-Encoding: 8bit';                   
                $cles = array_keys($_SESSION["commande"]["prod"]);                       
                
                if (isset($_POST["tremarques"]))
                        $remarques = $_POST["tremarques"];
                else
                        $remarques = 'Aucune.';
                //Numéro de commande : '.$NumeroCommande.'<br />         
                $messageclients = '<html>
                                                <head>
                                                        <title>
                                                                Votre Commande
                                                        </title>
                                                </head>
                                                <body>
                                                <p>Bonjour '.$_POST["tnom"].', votre commande a bien été prise en compte : <br /><br />
                                                        Téléphone : '.$_POST["ttel"].'<br />
                                                        Heure de passage : '.$_POST["theureh"].'h'.$_POST["theurem"].'<br/>
                                                        
                                        </p>
                                                <table width="600">
                                                  <caption style="font-size:20px;color:#000000;font-weight:bold;">Commande</caption>
                                                  <tr>
                                                         <th style="background:#FFFFFF;color:#000000;">Produit</th>
                                                         <th style="background:#FFFFFF;color:#000000;">Prix</th>
                                                         <th style="background:#FFFFFF;color:#000000;">Quantité</th>
                                                         <th style="background:#FFFFFF;color:#000000;">Sous total</th>
                                                  </tr> ';      
                $tot = 0;
                foreach($cles as $i){
                        if (array_key_exists($i, $_SESSION["commande"]["prod"]))
                        {
                                $_SESSION["commande"]["prix"][$i] = str_replace(",", ".", $_SESSION["commande"]["prix"][$i]);
                                $soustot = (float)$_SESSION["commande"]["prix"][$i] * (float)$_SESSION["commande"]["quantite"][$i];
                                
                                
                                $messageclients .=  '<tr>
                                                <td style="border:#000000 solid 1px;">
                                                                        '.stripslashes($_SESSION["commande"]["prod"][$i]).'
                                                                </td>
                                                                <td style="text-align:right;border:#000000 solid 1px;">
                                                                        '.$_SESSION["commande"]["prix"][$i].' CHF
                                                                </td>
                                                                <td style="text-align:center;border:#000000 solid 1px;">
                                                                        '.$_SESSION["commande"]["quantite"][$i].'
                                                                </td>
                                                                <td style="text-align:right;border:#000000 solid 1px;">
                                                                        '.number_format($soustot, 2, ',', ' ').' CHF
                                                                </td>                                                           
                                                          </tr>';
                                $tot += $soustot;
                        }          
                }
                $messageclients .= '</table><div style="text-align:right;margin-top:10px;width:600px;color:#000000;font-size:18px;">
                                                Total : '.number_format($tot, 2, ',', ' ').' CHF</div>
                                                <br /><br />
                                                Remarques : '.$remarques.'
                                                </body></html>';
                //Numéro de commande : '.$NumeroCommande.'<br />                                                                                  
                $message = '<html>
                                                <head>
                                                        <title>
                                                                Nouvelle commande
                                                        </title>
                                                </head>
                                                <body>
                                                <p>
                                                        Nom : '.$_POST["tnom"].'<br /> 
                                                        Téléphone : '.$_POST["ttel"].'<br />
                                                        Email : '.$_POST["tmail"].'<br >
                                                        Heure de passage : '.$_POST["theureh"].'h'.$_POST["theurem"].'<br/>
                                                        Remarques : '.$remarques.' <br />
                                                        
                                        </p>
                                                <table width="600">
                                                  <caption style="font-size:20px;color:#000000;font-weight:bold;">Commande</caption>
                                                  <tr>
                                                         <th style="background:#FFFFFF;color:#000000;font-size:12px;">Quantité</th>
                                                         <th style="background:#FFFFFF;color:#000000;font-size:12px;">Produit</th>
                                                         <th style="background:#FFFFFF;color:#000000;font-size:12px;">Prix</th>
                                                         <th style="background:#FFFFFF;color:#000000;font-size:12px;">Sous total</th>
                                                  </tr>';
                $tot = 0;
                foreach($cles as $i){
                        if (array_key_exists($i, $_SESSION["commande"]["prod"]))
                        {
                                $_SESSION["commande"]["prix"][$i] = str_replace(",", ".", $_SESSION["commande"]["prix"][$i]);
                                $soustot = (float)$_SESSION["commande"]["prix"][$i] * (float)$_SESSION["commande"]["quantite"][$i];
                                //$_SESSION["commande"]["prix"][$i] = str_replace(".", ",", $_SESSION["commande"]["prix"][$i]);//
                                
                                $message .=  '<tr>
                                                                <td style="border:#000000 solid 1px;text-align:center;">
                                                                        '.$_SESSION["commande"]["quantite"][$i].'
                                                                </td>
                                                <td style="border:#000000 solid 1px;">
                                                                        '.stripslashes($_SESSION["commande"]["prod"][$i]).'
                                                                </td>
                                                                <td style="text-align:right;border:#000000 solid 1px;">
                                                                        '.$_SESSION["commande"]["prix"][$i].' 
                                                                </td>
                                                                <td style="text-align:right;border:#000000 solid 1px;">
                                                                        '.number_format($soustot, 2, ',', ' ').' CHF
                                                                </td>                                                           
                                                          </tr>';
                                $tot += $soustot;
                        }          
                }
                $message .= '</table><div style="text-align:right;margin-top:10px;width:600px;color:#000000;font-size:18px;">
                                                Total : '.number_format($tot, 2, ',', ' ').' CHF</div></body></html>';
                        
                $mail = $params["mail"];
                
                if(@mail($mail, 'Commande Au petit comestible', $message, $headers) && @mail($_POST["tmail"], 'Commande Au petit comestible', $messageclients, $headers));
                
                

    
        
                {
                          echo '<br /><div style="text-align:center;margin-top:10px;width:650px;color:#4b4c38;font-size:18px;"><b>Commande envoyée!</b><br /> Un e-mail de confirmation a été envoyé à l\'adresse :<br /><br /><i> '.$_POST["tmail"].'</i></div>'; 
                                                    
                          
                          echo  
                          '<div class="paypal">
                            <p>Si vous souhaitez payer à l\'avance par carte de crédit, cliquez ici:</p>
                            <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
                            <input type="hidden" name="cmd" value="_cart">
                            <input type="hidden" name="business" value="malerba@aupetitcomestible.net">
                            <input type="hidden" name="lc" value="CH">
                            <input type="hidden" name="item_name" value="Commande">
                            <input type="hidden" name="amount" value="'.$tot.'">
                            <input type="hidden" name="currency_code" value="CHF">
                            <input type="hidden" name="button_subtype" value="products">
                            <input type="hidden" name="no_note" value="0">
                            <input type="hidden" name="add" value="1">
                            <input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
                            <input type="image" src="https://www.paypalobjects.com/fr_FR/CH/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - la solution de paiement en ligne la plus simple et la plus sécurisée !">
                            <img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
                            </form>
                           <br /> 
                           <br />
                           <br />                           
                            <div class="iscrizione2">
                            <table>
                            <tr><td><img src="Images/Design/news.png"></td>
                            <td>      
                            <form action="http://admin.infomaniak.com/mail/mailinglist_process.php" method="POST"> 
                            <b>Inscrivez-vous</b> gratuitement à notre news-letter pour recevoir les actualités de la semaine!<br />
                            Insérez votre adresse e-mail ici:
                            <input type="hidden" name="maillist" value="bmV3c2xldHRlckBhdXBldGl0Y29tZXN0aWJsZS5uZXQ="> 
                            <input type="text" name="email">
                            <input type="hidden" name="action" value="add">
                            <input type="hidden" name="url" value="http://aupetitcomestible.net/iscrizione.html">
                            <input type="submit" name="add" value="Inscription">
                            </form></td></tr>
                            </table>
                            </div></div>';                         
                             
                }       
                
/* STATISTICHE     */
$sqlcommande = "INSERT INTO tstat (idstat, datecommande, champtype, description, prix) VALUES( ";			  
			  foreach($cles as $i)
			  {
			  	if (array_key_exists($i, $_SESSION["commande"]["type"]) && $_SESSION["commande"]["type"] != NULL)
			  	{
			  		for ($j = 0; $j < $_SESSION["commande"]["quantite"][$i]; $j++)
			  		{		  			
				  		$desc = str_replace("<br />", " - ", $_SESSION["commande"]["prod"][$i]);
				  		$desc = strip_tags($desc);			  		
				  		$sqlcommande .= "'', '".date("Y-m-d")."', '".$_SESSION["commande"]["type"][$i]."', '".addslashes($desc)."',".$_SESSION["commande"]["prix"][$i]."'";             		  
				  	}
			  	 }
			  }
			  $sqlcommande = substr($sqlcommande, 0, strlen($sqlcommande)-1);
        $sqlcommande .= ");";  			  		  
			  mysql_query($sqlcommande) or die ("Erreur SQL > ".$sqlcommande."<br />".mysql_error()); 	
 
			  unset($_SESSION["commande"]);
 /* FINE STATISTICHE    */        
                }               
                else
                        echo '<br />Erreur répéter l\'opération.<div class="spa"></div>';
              
        }
?>
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 1 Mar 2013
  • #46
se metto un ; dopo la stringa con for funziona ma non calcola la quantità...però almeno non dà errore!

PHP:
for ($j = 0; $j < $_SESSION["commande"]["quantite"][$i]; $j++);
 

borgo italia

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
4 Feb 2008
16.044
150
63
PR
www.borgo-italia.it
  • 1 Mar 2013
  • #47
ciao
no penso che non dovrebbe essere quello, comunque se lo togli funziona? anche se quei cicli proprio non capisco a che servano, sei sicure di non averli modificati?
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 1 Mar 2013
  • #48
Se tolgo il ; funziona solo con 1 prodotto nell'ordine (quantità=1).
Se metto il ; funziona, ma anche se nell'ordine la quantità è > di 1 nella tabella inserisce comunque quantità=1
Se metto la riga come era prima e/o se tolgo il ;ecco l'errore (sempre lo stesso):

Erreur SQL > INSERT INTO tstat (idstat, datecommande, champtype, description, prix) VALUES( '', '2013-03-01', 'sand', 'Giorgio - Sandwiche - ',10.00''', '2013-03-01', 'sand', 'Giorgio - Sandwiche - ',10.00);
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 '''', '2013-03-01', 'sand', 'Giorgio - Sandwiche - ',10.00)' at line 1


Ma chi ha inventato il php?????
 

borgo italia

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
4 Feb 2008
16.044
150
63
PR
www.borgo-italia.it
  • 1 Mar 2013
  • #49
ciao
è quello che non capisco di quei cicli infatti da
INSERT INTO tstat (idstat, datecommande, champtype, description, prix) VALUES( '', '2013-03-01', 'sand', 'Giorgio - Sandwiche - ',10.00''', '2013-03-01', 'sand', 'Giorgio - Sandwiche - ',10.00);
ripetendo due volte i values
INSERT INTO tstat (idstat, datecommande, champtype, description, prix) VALUES( '', '2013-03-01', 'sand', 'Giorgio - Sandwiche - ',10.00''', '2013-03-01', 'sand', 'Giorgio - Sandwiche - ',10.00);
la query divrebbe risultare
INSERT INTO tstat (idstat, datecommande, champtype, description, prix) VALUES( '', '2013-03-01', 'sand', 'Giorgio - Sandwiche - ',10.00)
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 2 Mar 2013
  • #50
Ciao,
per caso non si potrebbe riscrivere lo script?
(non mi insultare...)
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 6 Mar 2013
  • #51
Ciao!
Ancora, ovviamente, non sono riuscito a risolvere l'enigma, in compenso ho notato (e sai che scoperta) che nella versione vecchia l'errore avviene ugualmente.
Quindi ti ho detto una bella c..., non è vero che funzionava!
Però il mio amico dice di sì. Quindi mi chiedevo: potrebbe essere un problema di aggiornamento PHP o roba del genere...
Sempre grazie mille!!!
 

borgo italia

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
4 Feb 2008
16.044
150
63
PR
www.borgo-italia.it
  • 6 Mar 2013
  • #52
ciao
si potrebbe, dipende da quanto è vecchio lo script.
tieni inoltre presente che mettere le mani di script di altri, a mio parere, è sempre una rogna.
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 6 Mar 2013
  • #53
ah ecco! allora credo che sia un problema di questo tipo!
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 6 Mar 2013
  • #54
ma come lo risolvo dunque?
 

borgo italia

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
4 Feb 2008
16.044
150
63
PR
www.borgo-italia.it
  • 6 Mar 2013
  • #55
ciao
prova a guardare nei vari script se al posto di $_POST['nome'] c'è $HTTP_POST_VARS ['nome'] lo script è vecchissimo e da buttare.
oggi cominciano ad essere deprecate anche le query al db tipo mysql_query e similari.

posso sbagliarmi (lo spero), ma la soluzione è rifare ex novo
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 6 Mar 2013
  • #56
Non voglio essere scortese, ma non c'è nessuna anima pia nel forum che potrebbe riscrivere lo script? Chiedo troppo forse? Non mi rendo bene conto...
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 6 Mar 2013
  • #57
No, il comando $HTTP_POST_VARS non appare mai!
C'è sempre ($_POST["tnom"]).
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 6 Mar 2013
  • #58
forse mi sono perso qualche passaggio vista la lunghezza della discussione, ma immagino che se i prodotti siano piu di uno tu debba fare piu INSERT
in questo caso il primo pezzo di query dovrebbe andare all'interno del ciclo
PHP:
foreach ($cles as $i) {
    $sqlcommande = "INSERT INTO tstat (idstat, datecommande, champtype, description, prix) VALUES( ";
 

borgo italia

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
4 Feb 2008
16.044
150
63
PR
www.borgo-italia.it
  • 6 Mar 2013
  • #59
ciao criric
quello che non capisco è la concatenazione di quello che segue.
non so quello che succede nelle pagine precedenti, ma piu che la parte iniziale delle query (forse) va dentro il foreach anche la mysql_query, cioè inserisce e riparte con la nuova query.
però come detto bisogerebbe sapere come è il meccanismo del tutto e perchè nell'originale il programmatore abbia gfatto quell'ambaradan.
comunque da provare a mettere all'interno come dici tu (s.l.v. ossia se la và)
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 6 Mar 2013
  • #60
dunque ho fatto comne dice criric (grazie mille per l'interesse), ma non cambia nulla.
L'errore è sempre lo stesso:

Erreur SQL > INSERT INTO tstat (idstat, datecommande, champtype, description, prix) VALUES( '', '2013-03-06', 'shop', 'Focaccia - ',3.00''', '2013-03-06', 'shop', 'Focaccia - ',3.00);
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 '''', '2013-03-06', 'shop', 'Focaccia - ',3.00)' at line 1

Con 1 solo ordine funziona, se la quantità è 2 (o >) dà questo errore...
Perché non si separano? cioè dopo "near", nell'errore, non dovrebbe esserci una parentesi?
Cioè bla bla...server version for the right syntax to use near ....'')'('', '2013-03-06', 'shop', 'Focaccia - ',3.00)' at line 1

Forse l'errore è qui???
Domanda da un milione di dollari...
 
Prec.
  • 1
  • 2
  • 3
  • 4
  • 5
Succ.
Primo Prec. 3 di 5 Succ. Ultimo
Devi accedere o registrarti per poter rispondere.

Discussioni simili

T
  • Bloccata
ALTRO PROBLEMA CON ARRAY PHP
  • thanatos
  • 30 Mag 2021
  • PHP
Risposte
1
Visite
2K
PHP 30 Mag 2021
Max 1
T
PROBLEMA CON ARRAY
  • thanatos
  • 27 Mag 2021
  • PHP
Risposte
8
Visite
2K
PHP 31 Mag 2021
marino51
C
[Javascript] problema nell'utilizzo di un array
  • Ctrl+Alt+Mario
  • 27 Ott 2018
  • Javascript
Risposte
2
Visite
2K
Javascript 27 Ott 2018
Ctrl+Alt+Mario
C
F
[PHP] Problema con array multidimensionale
  • Francesco Iacomino
  • 27 Set 2018
  • PHP
Risposte
4
Visite
2K
PHP 27 Set 2018
Francesco Iacomino
F
[PHP] Popolamento database con form ricorsivi - problema array (foreach )
  • alessandra86
  • 28 Giu 2018
  • PHP
Risposte
5
Visite
3K
PHP 12 Lug 2018
alessandra86
A
[java] problema esercizio array
  • Andrespo
  • 3 Giu 2018
  • Java
Risposte
5
Visite
3K
Java 5 Giu 2018
Andrespo
A
P
[PHP] Problema inserimento nuove chiavi in array
  • pierPHP
  • 18 Mar 2018
  • PHP
Risposte
2
Visite
1K
PHP 18 Mar 2018
pierPHP
P
R
[PHP] Problema stampa array bidimensionali con formula $html.=<<<myHtml...
  • rob466
  • 10 Feb 2018
  • PHP
Risposte
2
Visite
2K
PHP 10 Feb 2018
rob466
R
S
problema con gli array in javascript
  • stefano Linguanti
  • 18 Mag 2016
  • Javascript
Risposte
12
Visite
3K
Javascript 24 Mag 2016
stefano Linguanti
S
C
Problema con creazione array
  • camionistaxcaso
  • 14 Gen 2016
  • PHP
Risposte
7
Visite
2K
PHP 19 Gen 2016
camionistaxcaso
C
V
Problema con array
  • Vera
  • 22 Ott 2015
  • PHP
Risposte
8
Visite
1K
PHP 23 Ott 2015
Vera
V
PHP/MySQL - Problema con generazione array
  • neo996sps
  • 21 Ott 2015
  • PHP
Risposte
14
Visite
3K
PHP 23 Ott 2015
marino51
P
problema con mysql_fetch_array()
  • paperinik4
  • 30 Giu 2015
  • PHP
Risposte
2
Visite
1K
PHP 30 Giu 2015
paperinik4
P
M
Problema ordinamento array
  • maced
  • 28 Ott 2014
  • PHP
Risposte
4
Visite
2K
PHP 28 Ott 2014
borgo italia
L
problema array con le sessioni
  • luigi777
  • 13 Mag 2014
  • PHP
Risposte
1
Visite
1K
PHP 13 Mag 2014
luigi777
L
[risolto] PHP problema memorizzazione array
  • Alessandro Le Mura
  • 9 Feb 2014
  • PHP
Risposte
4
Visite
2K
PHP 10 Feb 2014
Alessandro Le Mura
F
Problema formattazione data e creazione array con nuove date
  • fradamma
  • 14 Nov 2013
  • Javascript
Risposte
2
Visite
2K
Javascript 16 Nov 2013
fradamma
F
S
Problema trasformazione array php in javascript
  • ste902
  • 14 Set 2013
  • PHP
Risposte
0
Visite
1K
PHP 14 Set 2013
ste902
S
F
problema Json con Array
  • fradamma
  • 2 Set 2013
  • jQuery
Risposte
1
Visite
2K
jQuery 3 Set 2013
fradamma
F
F
Problema associazione tabs/oggetto array
  • fradamma
  • 31 Lug 2013
  • jQuery
Risposte
17
Visite
3K
jQuery 25 Ago 2013
criric
Condividi:
Facebook X (Twitter) LinkedIn WhatsApp e-mail Condividi Link
  • Home
  • Forum
  • Fare Web
  • PHP
  • Italiano
  • Termini e condizioni d'uso del sito
  • Policy Privacy
  • Aiuto
  • Home
Community platform by XenForo® © 2010-2024 XenForo Ltd. | Traduzione a cura di XenForo Italia
Menu
Accedi

Registrati

  • Home
  • Forum
    • Nuovi Messaggi
    • Cerca...
  • Novità
    • Featured content
    • Nuovi Messaggi
    • Ultime Attività
X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?

X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?