• 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
Primo Prec. 5 di 5

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 7 Mar 2013
  • #81
le query mi sembrano giuste ora
non è che hai tolto
PHP:
mysql_query($sqlcommande) or die ("Erreur SQL > ".$sqlcommande."<br />".mysql_error());
?
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 7 Mar 2013
  • #82
Sì, come ti ho scritto DAN=2, cioè quantità=2.
Ma purtroppo anche con una sola non succede nulla, a parte quel messaggio (senza ERROR ...)
Dovrò farmi ricoverare...
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 7 Mar 2013
  • #83
Certo che l'ho tolto, sono un vero cr.....
Aspè...
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 7 Mar 2013
  • #84
L'ho messo ma non cambia nulla, stesso messaggio senza errore.
Ecco com'è il codice adesso:

PHP:
$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] . "'),";
        // aggiunte parentesi e virgola per chiudere la prima insert
            
        }
        
    }
}
$sqlcommande = substr($sqlcommande, 0, strlen($sqlcommande) - 1);
echo $sqlcommande;
mysql_query($sqlcommande) or die ("Erreur SQL > ".$sqlcommande."<br />".mysql_error());  
// $sqlcommande .= ");"; tolta la chiusura   
      
                }               
                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
  • 8 Mar 2013
  • #85
Ma sai che sembra funzionare!!!!!!!
Ho talmente paura a dirlo che non ci credo...
però non capisco perché mi deve dare sempre il messaggio:

INSERT INTO tstat (idstat, datecommande, champtype, description, prix) VALUES ('', '2013-03-08', 'sand', 'DAN - Sandwiche - ','13.00'),('', '2013-03-08', 'sand', 'Stella - Sandwiche - ','12.00'),('', '2013-03-08', 'sand', 'Stella - Sandwiche - ','12.00'),('', '2013-03-08', 'sand', 'Stella - Sandwiche - ','12.00')

Però la query è perfetta, porca vacca, sei un genio!!!!!
 

criric

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
21 Ago 2010
5.606
54
48
TN
  • 8 Mar 2013
  • #86
togli questo
PHP:
echo $sqlcommande;
l'abbiamo messo per vedere la sintassi della query :fonzie:
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 8 Mar 2013
  • #87
Ho tolto

echo $sqlcommande;

e sembra funzionare...

io giuro non so come ringraziarvi....
veramente, di cuore grazie, siete fantastici!!!!!!!!!!!!!
 
F

Fabrizio Villa

Utente Attivo
19 Gen 2013
131
0
16
  • 8 Mar 2013
  • #88
Miiiiiii, non ci credoooooo, funzionaaaaaaaaaa!!!!!!!!!!!!
 
Prec.
  • 1
  • 2
  • 3
  • 4
  • 5
Primo Prec. 5 di 5
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?