Erreur #1452 - MySql
Résolu
woulfmoon
Messages postés
110
Date d'inscription
Statut
Membre
Dernière intervention
-
woulfmoon Messages postés 110 Date d'inscription Statut Membre Dernière intervention -
woulfmoon Messages postés 110 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'utilise PHPMyAdmin.
Je possède moult tables dans ma base de données mais depuis ce matin, j'en ai rajouté 2 dedans et elles ne veulent pas se mettre en relation, je m'explique :
PHPMyAdmin me ressort cette erreur :
#1452 - Cannot add or update a child row: a foreign key constraint fails ('chu'.<result 2 when explaining filename '#sql-99c_1bd'>, CONSTRAINT '#sql-99c_1bd_ibfk_2' FOREIGN KEY ('FK_idFonction') REFERENCES 'fonction' ('idFonction'))
Voici mes deux tables que je veux mettre en relation :
CREATE TABLE 'chu'.'fonction' (
'idFonction' int( 5 ) NOT NULL AUTO_INCREMENT ,
'libFonction' varchar( 50 ) NOT NULL ,
PRIMARY KEY ( 'idFonction' )
) ENGINE = InnoDB;
CREATE TABLE 'chu'.'beneficiaire' (
'idBenef' int( 10 ) NOT NULL AUTO_INCREMENT ,
'nomBenef' varchar( 20 ) NOT NULL ,
'prenomBenef' varchar( 20 ) NOT NULL ,
'numTelBenef' varchar( 14 ) NOT NULL ,
'FK_idUF' int( 5 ) NOT NULL ,
'FK_idFonction' int( 5 ) NOT NULL ,
PRIMARY KEY ( 'idBenef' ) ,
KEY 'FK_idUF' ( 'FK_idUF' ) ,
KEY 'FK_idFonction' ( 'FK_idFonction' )
) ENGINE = InnoDB;
Et mon 'beneficiaire'.FK_idFonction et 'fonction'.FK_idFonction ne veulant pas se mettre en relation, quelqu'un aurait il une solution?
Pour info, je les ai créées ce matin, supprimé la table fonction et l'ait recrée plus tard mais le problème survient.
En attente d'aide,
merci
j'utilise PHPMyAdmin.
Je possède moult tables dans ma base de données mais depuis ce matin, j'en ai rajouté 2 dedans et elles ne veulent pas se mettre en relation, je m'explique :
PHPMyAdmin me ressort cette erreur :
#1452 - Cannot add or update a child row: a foreign key constraint fails ('chu'.<result 2 when explaining filename '#sql-99c_1bd'>, CONSTRAINT '#sql-99c_1bd_ibfk_2' FOREIGN KEY ('FK_idFonction') REFERENCES 'fonction' ('idFonction'))
Voici mes deux tables que je veux mettre en relation :
CREATE TABLE 'chu'.'fonction' (
'idFonction' int( 5 ) NOT NULL AUTO_INCREMENT ,
'libFonction' varchar( 50 ) NOT NULL ,
PRIMARY KEY ( 'idFonction' )
) ENGINE = InnoDB;
CREATE TABLE 'chu'.'beneficiaire' (
'idBenef' int( 10 ) NOT NULL AUTO_INCREMENT ,
'nomBenef' varchar( 20 ) NOT NULL ,
'prenomBenef' varchar( 20 ) NOT NULL ,
'numTelBenef' varchar( 14 ) NOT NULL ,
'FK_idUF' int( 5 ) NOT NULL ,
'FK_idFonction' int( 5 ) NOT NULL ,
PRIMARY KEY ( 'idBenef' ) ,
KEY 'FK_idUF' ( 'FK_idUF' ) ,
KEY 'FK_idFonction' ( 'FK_idFonction' )
) ENGINE = InnoDB;
Et mon 'beneficiaire'.FK_idFonction et 'fonction'.FK_idFonction ne veulant pas se mettre en relation, quelqu'un aurait il une solution?
Pour info, je les ai créées ce matin, supprimé la table fonction et l'ait recrée plus tard mais le problème survient.
En attente d'aide,
merci
A voir également:
- #1452 - cannot add or update a child row: a foreign key constraint fails
- Or - Guide
- Key windows 10 - Guide
- Windows update bloqué - Guide
- Winget update - Guide
- Asus live update - Télécharger - Utilitaires