Bonjour tous !
Voici l'erreur sql que je reçoit lors de l'insertion des données dans ma table.
Voici la requête :
Code : Sélectionner tout - Visualiser dans une fenêtre à part Cannot add or update a child row: a foreign key constraint fails ('cybernet'.'site', CONSTRAINT 'fk_site_provider' FOREIGN KEY ('idprovider') REFERENCES 'provider' ('id') ON DELETE NO ACTION ON UPDATE NO ACTION)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 $sql = 'INSERT INTO 'site' ('id' ,'idsiteinterne' ,'idsiteprovider','site_name' ,'dateactivation' ,'dateinstallation' ,'adressesite' ,'installerpar' ,'idclient' ,'adresseIP' ,'adresseIPmanage' ,'emailsite' ,'idprovider' ,'service' ,'idetatsite' ,'idpays' ,'province' ,'telephone' ,'observation' ,'datecreation') VALUES (NULL, "'.mysql_escape_string($_POST['idsiteinterne']).'", "'.mysql_escape_string($_POST['idsiteprovider']).'","'.mysql_escape_string($_POST['site_name']).'", "'.mysql_escape_string($_POST['dateinstallation']('d-m-Y')).'" , "'.mysql_escape_string($_POST['dateactivation']('d-m-Y')).'", "'.mysql_escape_string($_POST['adressesite']).'", "'.mysql_escape_string($_POST['installerpar']).'", "'.mysql_escape_string($_POST['idclient']).'", "'.mysql_escape_string($_POST['adresseIP']).'", "'.mysql_escape_string($_POST['adresseIPmanage']).'", "'.mysql_escape_string($_POST['emailsite']).'", "'.mysql_escape_string($_POST['idprovider']).'","'.mysql_escape_string($_POST['service']).'", "'.mysql_escape_string($_POST['province']).'", "'.mysql_escape_string($_POST['idetatsite']).'", "'.mysql_escape_string($_POST['province']).'", "'.mysql_escape_string($_POST['telephone']).'", "'.mysql_escape_string($_POST['observation']).'", "'.date('Y-m-d h:i:s').'")'; mysql_query($sql) or die('Erreur SQL !'.$sql.'<br />'.mysql_error());
Partager