Insert into $_session
Résolu
techinfo46
Messages postés
383
Date d'inscription
Statut
Membre
Dernière intervention
-
techinfo46 Messages postés 383 Date d'inscription Statut Membre Dernière intervention -
techinfo46 Messages postés 383 Date d'inscription Statut Membre Dernière intervention -
Bonjour, voila mon script
$req_bailleur="INSERT INTO bailleur (NOMBAILLEUR_1,
PRENOMBAILLEUR_1,
ADRESSEBAILLEUR_1,
TELBAILLEUR_1,
FAXBAILLEUR_1,
VILLEBAILLEUR_1,
CODEPOSTALBAILLEUR_1,
MAILBAILLEUR_1)
(ligne20) VALUES('$_SESSION['BAILLEURPHYSIQUE'][$i]['nombailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['prenombailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['adressebailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['telbailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['faxbailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['villebailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['codepostalbailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['mailbailleur']'
)";
et voici l'erreur
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files (x86)\EasyPHP-5.3.8.0\www\test7.php on line 20
$req_bailleur="INSERT INTO bailleur (NOMBAILLEUR_1,
PRENOMBAILLEUR_1,
ADRESSEBAILLEUR_1,
TELBAILLEUR_1,
FAXBAILLEUR_1,
VILLEBAILLEUR_1,
CODEPOSTALBAILLEUR_1,
MAILBAILLEUR_1)
(ligne20) VALUES('$_SESSION['BAILLEURPHYSIQUE'][$i]['nombailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['prenombailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['adressebailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['telbailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['faxbailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['villebailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['codepostalbailleur']',
'$_SESSION['BAILLEURPHYSIQUE'][$i]['mailbailleur']'
)";
et voici l'erreur
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files (x86)\EasyPHP-5.3.8.0\www\test7.php on line 20
A voir également:
- Insert into $_session
- Touche insert - Guide
- Disk boot failure insert system disk and press enter - Guide
- Insert boot media in selected boot device and press a key ✓ - Forum Windows 10
- Activer touche insert sur ASUS UX32A - Forum Clavier
- Monitor will go into standby mode traduction français ✓ - Forum Matériel & Système
2 réponses
Bonsoir
Régle d'écriture des chaînes en PHP :
Quand tu utilises une variable tableau dans une chaîne entre double quotes, il NE FAUT PAS mettre les simples quotes autour de l'indice
Autrement dit :
Dans le doute, tu peux toujours créer ta chaîne par concaténation, tu n'as plus besoin de te rappeler cette règle bizarre
Régle d'écriture des chaînes en PHP :
Quand tu utilises une variable tableau dans une chaîne entre double quotes, il NE FAUT PAS mettre les simples quotes autour de l'indice
Autrement dit :
$req_bailleur="INSERT INTO bailleur (NOMBAILLEUR_1, PRENOMBAILLEUR_1, ADRESSEBAILLEUR_1, TELBAILLEUR_1, FAXBAILLEUR_1, VILLEBAILLEUR_1, CODEPOSTALBAILLEUR_1, MAILBAILLEUR_1) VALUES('$_SESSION[BAILLEURPHYSIQUE][$i][nombailleur]', '$_SESSION[BAILLEURPHYSIQUE][$i][prenombailleur]', '$_SESSION[BAILLEURPHYSIQUE][$i][adressebailleur]', '$_SESSION[BAILLEURPHYSIQUE][$i][telbailleur]', '$_SESSION[BAILLEURPHYSIQUE][$i][faxbailleur]', '$_SESSION[BAILLEURPHYSIQUE][$i][villebailleur]', '$_SESSION[BAILLEURPHYSIQUE][$i][codepostalbailleur]', '$_SESSION[BAILLEURPHYSIQUE][$i][mailbailleur']' )";
Dans le doute, tu peux toujours créer ta chaîne par concaténation, tu n'as plus besoin de te rappeler cette règle bizarre