I have a problem using a long INSERT request in SQL, my request were working perfectl before I updated it , but now the instruction doesn't insert anything in my database and also doesn't make any error message. Here's the code :
try
{
/* On connecte à la base de données MySQL */
$bdd = new PDO('mysql:host=myhost;dbname=mydbname', 'root', 'mypass');
/* On définit la requête SQL à exécuter */
$requeteInscription = 'INSERT INTO interventions
(utilisateur_id, nom_proprietaire,
num_tel_proprietaire, courriel_proprietaire,
informations_bien, interet, delai,
plan_2D, plan_3D, visite_virtuelle,
shooting_photo, annee_construction,
installation_gaz, cle_agence, cave,
garage, type_bien, surface, adresse)
VALUES ("'.$utilisateurId.'","'.$nomProprietaire.'","'
.$numTelProprietaire.'","'.$courrielProprietaire.'","'
.$infosBien.'","'.$delai.'","'
.$plan2D.'","'.$plan3D.'","'.$visiteVirtuelle.'","'
.$shootingPhoto.'","'.$anneeConstruction.'","'
.$installationGaz.'","'.$cleAgence.'","'.$cave.'","'
.$garage.'","'.$typeBien.'","'.$surface.'","'.$adresse.'")';
sleep(1);
$requete = $bdd->prepare($requeteInscription);
$requete->execute();
echo '#1';
}
catch(PDOException $e)
{
echo('Erreur! : '.$e->getMessage().'</br>');
die();
}
And here is the request returned when I make an echo on requeteInscription :
INSERT INTO interventions (utilisateur_id, nom_proprietaire, num_tel_proprietaire, courriel_proprietaire, informations_bien, interet, delai, plan_2D, plan_3D, visite_virtuelle, shooting_photo, annee_construction, installation_gaz, cle_agence, cave, garage, type_bien, surface, adresse) VALUES ("5","Cyrille ","946458","hidden.email@stackoverflow.com","Local d'activité","Entre 4 et 6 jours.","Oui","Non","1","Non","1","2","0","1","1","3","123","Hdhdhd")
I don't see where the syntax error is (I guess it's a syntax error because when I do one, it never give me back an error message)
you are missing one value in insert query. Please add one more value in insert query. Remaining query is fine.
INSERT INTO interventions (utilisateur_id, nom_proprietaire, num_tel_proprietaire, courriel_proprietaire, informations_bien, interet, delai, plan_2D, plan_3D, visite_virtuelle, shooting_photo, annee_construction, installation_gaz, cle_agence, cave, garage, type_bien, surface, adresse) VALUES ("5","Cyrille ","946458","hidden.email@stackoverflow.com","Local d'activité","Entre 4 et 6 jours.","Oui","Non","1","Non","1","2","0","1","1","3","123","Hdhdhd","");