我有一个问题,在SQL中使用长INSERT请求,我的请求在我更新它之前工作得很好,但现在指令不插入任何东西在我的数据库中,也不做任何错误消息。下面是代码:
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();
}
这是当我在requeteInscription上执行echo时返回的请求:
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")
我没有看到语法错误在哪里(我猜这是一个语法错误,因为当我做一个,它从来没有给我一个错误消息)
您在插入查询中缺少一个值。请在插入查询中再添加一个值。剩余查询正常
INSERT INTO interventions (utilisateur_id, nom_proprietaire, num_tel_proprietaire, courriel_proprietaire, informations_bien, internet, delai, plan_2D, plan_3D, visite_virtuelle, shooting_photo, annee_construction, installation_gaz, cle_agence, cave, garage, type_bien, surface, address) VALUES ("5","Cyrille ","946458","hidden.email@stackoverflow.com","Local d' activit