Projet informatique
Résolu/Fermé
Anonymous95340
Messages postés
114
Date d'inscription
lundi 5 octobre 2015
Statut
Membre
Dernière intervention
7 décembre 2020
-
11 avril 2017 à 13:08
jordane45 Messages postés 38112 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 29 mars 2024 - 17 mai 2017 à 02:55
jordane45 Messages postés 38112 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 29 mars 2024 - 17 mai 2017 à 02:55
A voir également:
- Projet informatique
- Le code ascii en informatique - Guide
- Jargon informatique - Télécharger - Bureautique
- Gantt projet - Télécharger - Gestion de projets
- Tfc informatique de gestion g3 pdf - Forum Bases de données
- Que veut dire url en informatique - Guide
2 réponses
jordane45
Messages postés
38112
Date d'inscription
mercredi 22 octobre 2003
Statut
Modérateur
Dernière intervention
29 mars 2024
4 634
11 avril 2017 à 14:13
11 avril 2017 à 14:13
Bonjour,
Oui c'est possible.
Il suffit de faire des requêtes INSERT (pour créer un nouvel enregistrement ) ou UPDATE (si c'est pour mettre à jour).
Je voudrais que pendant son s'inscription au site tous les champs qu'il rempli (login, mdp ,email,nom, prénom,adresse,code postal, fonction(si il est président, secrétaire etc...) association) sois directement enregistrer dans la base de données est ce possible?
Oui c'est possible.
Il suffit de faire des requêtes INSERT (pour créer un nouvel enregistrement ) ou UPDATE (si c'est pour mettre à jour).
Anonymous95340
Messages postés
114
Date d'inscription
lundi 5 octobre 2015
Statut
Membre
Dernière intervention
7 décembre 2020
1
Modifié le 26 avril 2017 à 15:12
Modifié le 26 avril 2017 à 15:12
Bonjour,
Désolé de vous répondre si tardivement je vous envoi ce que j'ai fais.
J'ai crée mes tables avec le logiciel MySQL Workbench
Désolé de vous répondre si tardivement je vous envoi ce que j'ai fais.
J'ai crée mes tables avec le logiciel MySQL Workbench
-- MySQL Script generated by MySQL Workbench -- 04/26/17 14:36:35 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema m2l -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema m2l -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `m2l` DEFAULT CHARACTER SET utf8 ; USE `m2l` ; -- ----------------------------------------------------- -- Table `m2l`.`Internevant` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `m2l`.`Internevant` ( `idInternevant` INT NOT NULL AUTO_INCREMENT, `nom` VARCHAR(45) NULL, `prenom` VARCHAR(45) NULL, `titre` VARCHAR(45) NULL, `adresse` VARCHAR(45) NULL, `codePostal` INT NULL, `email` VARCHAR(45) NULL, `tel` INT NULL, PRIMARY KEY (`idInternevant`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `m2l`.`Tag` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `m2l`.`Tag` ( `idTag` INT NOT NULL AUTO_INCREMENT, `libelle` VARCHAR(255) NULL, PRIMARY KEY (`idTag`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `m2l`.`Association` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `m2l`.`Association` ( `idAssociation` INT NOT NULL AUTO_INCREMENT, `nom` VARCHAR(255) NULL, `adresse` VARCHAR(255) NULL, `codePostal` INT NULL, `tel` INT NULL, `email` VARCHAR(255) NULL, PRIMARY KEY (`idAssociation`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `m2l`.`Formation` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `m2l`.`Formation` ( `idFormation` INT NOT NULL AUTO_INCREMENT, `titre` VARCHAR(255) NULL, `descriptif` VARCHAR(255) NULL, PRIMARY KEY (`idFormation`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `m2l`.`sessionFormation` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `m2l`.`sessionFormation` ( `idSeesion` INT NOT NULL AUTO_INCREMENT, `Internevant_idInternevant` INT NOT NULL, `Formation_idFormation` INT NOT NULL, `dateLimiteInscription` DATETIME NULL, `dateDebut` DATETIME NULL, `Salle` VARCHAR(255) NULL, PRIMARY KEY (`idSeesion`, `Internevant_idInternevant`, `Formation_idFormation`), INDEX `fk_Internevant_has_Formation_Formation1_idx` (`Formation_idFormation` ASC), INDEX `fk_Internevant_has_Formation_Internevant_idx` (`Internevant_idInternevant` ASC), CONSTRAINT `fk_Internevant_has_Formation_Internevant` FOREIGN KEY (`Internevant_idInternevant`) REFERENCES `m2l`.`Internevant` (`idInternevant`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Internevant_has_Formation_Formation1` FOREIGN KEY (`Formation_idFormation`) REFERENCES `m2l`.`Formation` (`idFormation`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `m2l`.`inscription` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `m2l`.`inscription` ( `idPersonne` INT NOT NULL AUTO_INCREMENT, `sessionFormation_idSeesion` INT NOT NULL, PRIMARY KEY (`idPersonne`, `sessionFormation_idSeesion`), INDEX `fk_inscription_sessionFormation1_idx` (`sessionFormation_idSeesion` ASC), CONSTRAINT `fk_inscription_sessionFormation1` FOREIGN KEY (`sessionFormation_idSeesion`) REFERENCES `m2l`.`sessionFormation` (`idSeesion`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `m2l`.`personnelassociatif` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `m2l`.`personnelassociatif` ( `idpersonne` INT NOT NULL AUTO_INCREMENT, `login` VARCHAR(45) NULL, `mdp` VARCHAR(45) NULL, `adresse` VARCHAR(45) NULL, `email` VARCHAR(45) NULL, `nom` VARCHAR(45) NULL, `prenom` VARCHAR(45) NULL, `tel` INT NULL, `codePostal` INT NULL, `fonction` VARCHAR(45) NULL, `actif` VARCHAR(45) NULL, `Association_idAssociation` INT NOT NULL, PRIMARY KEY (`idpersonne`, `Association_idAssociation`), INDEX `fk_personnelassociatif_Association1_idx` (`Association_idAssociation` ASC), CONSTRAINT `fk_personnelassociatif_Association1` FOREIGN KEY (`Association_idAssociation`) REFERENCES `m2l`.`Association` (`idAssociation`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `m2l`.`theme` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `m2l`.`theme` ( `idTag` INT NOT NULL AUTO_INCREMENT, `Formation_idFormation` INT NOT NULL, PRIMARY KEY (`idTag`, `Formation_idFormation`), INDEX `fk_theme_Formation1_idx` (`Formation_idFormation` ASC), CONSTRAINT `fk_theme_Formation1` FOREIGN KEY (`Formation_idFormation`) REFERENCES `m2l`.`Formation` (`idFormation`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
EDIT : Ajout du LANGAGE dans les balises de code (la coloration syntaxique).
Explications disponibles ici :ICI Merci d'y penser dans tes prochains messages. |
jordane45
Messages postés
38112
Date d'inscription
mercredi 22 octobre 2003
Statut
Modérateur
Dernière intervention
29 mars 2024
4 634
26 avril 2017 à 15:14
26 avril 2017 à 15:14
Ok tu as créés tes tables ... et ensuite ? Peux tu expliquer en détail sur quoi tu coinces et en nous montrant le code associé (car je ne pense pas que tu insères les données à la main dans tes tables....... )
Anonymous95340
Messages postés
114
Date d'inscription
lundi 5 octobre 2015
Statut
Membre
Dernière intervention
7 décembre 2020
1
Modifié le 3 mai 2017 à 21:47
Modifié le 3 mai 2017 à 21:47
Si justement j’insère les données a la main dans mes tables. La ou je coince c'est au niveau des clés étrangères.
Car dans mon formulaire d'inscription la table que j'utilise est personnelAssociatif
Cela m'affiche une erreur
page inscription ou il y a le codePHP
page inscriptionView ou il y a le code HTML
Car dans mon formulaire d'inscription la table que j'utilise est personnelAssociatif
Cela m'affiche une erreur
page inscription ou il y a le codePHP
<?php //print_r($_POST); require 'config/database.php'; //require 'includes/fonctions.php'; if (isset($_POST['inscription'])) { $errors = []; $login = htmlspecialchars($_POST['login']); $nom = htmlspecialchars($_POST['nom']); $prenom = htmlspecialchars($_POST['prenom']); $adresse = htmlspecialchars($_POST['adresse']); //hachage du mot de passe $mdp = sha1($_POST['mdp']); $mdp2 = sha1($_POST['mdp2']); $email = htmlspecialchars($_POST['email']); $email2 = htmlspecialchars($_POST['email2']); $tel = ($_POST['tel']); $cp = ($_POST['cp']); $fonction =($_POST['fonction']); $idassociation = ($_POST['idassociation']); $actif = ($_POST['actif']); //Fonction pour vérifier Si les variables sont pas vides if (!empty([$login]) && !empty([$mdp]) && !empty([$mdp2]) && !empty([$nom]) && !empty([$prenom]) && !empty([$adresse]) && !empty([$email]) && !empty([$email2]) && !empty([$cp]) && !empty([$tel]) && !empty([$fonction] && !empty([$idassociation]))) { $loginlength = strlen($login); if ($loginlength <= 255) { if ($email == $email2) { if (filter_var($email, FILTER_VALIDATE_EMAIL)) { //Requete permettant de savoir si le mail est deja utilisé $reqmail = $db->prepare("SELECT * FROM personnelassociatif WHERE email = ?"); $reqmail->execute([$email]); $mailexist = $reqmail->rowCount(); if ($mailexist == 0) { if ($mdp == $mdp2) { //Insert les informations et cree le compte $insertmbr = $db->prepare("INSERT INTO personnelassociatif(login,email,mdp,nom,prenom,adresse,codePostal,tel,fonction,actif,idAssociation) VALUES(?,?,?,?,?,?,?,?,?,?,?)"); $insertmbr->execute(array($login,$mdp,$email,$nom,$prenom,$adresse,$cp,$tel,$fonction,$actif,$idassociation)); //$_SESSION['comptecree'] = "Votre compte a été crée"; header('location: connexion.php'); } else { $errors[] = 'Vos mots de passe correspondent pas'; } } else { $errors [] = 'Adresse mail deja utilisé '; } } else { $errors[] = 'Votre adresse mail est pas valide'; } } else { $errors[] = "Vos adresses mail correspondent pas"; } } } else { $errors[] = 'Tous les champs doivent être complétés'; } } ?> <?php require ('views/inscriptionView.php'); ?>
page inscriptionView ou il y a le code HTML
<?php $title = "Inscription"; ?> <?php include("includes/constantes.php"); ?> <?php include("partials/Header.php"); ?> <div id="main-content"> <div class="container"> <h1 class="text-center">Devenez dès à présent membre!</h1> <?php include 'partials/erreurs.php'; ?> <form method="POST" class="well col-md-6 col-md-offset-3" autocomplete="on" action="inscription.php"> <!-- login --> <div class="form-group"> <label class="control-label" for="login">Login</label> <input type="text" class="form-control" id="login" value="<?php if (isset($login)) { echo $login; } ?>" name="login" required="required"/> </div> <!-- Password --> <div class="form-group"> <label class="control-label" for="mdp">Mot de passe</label> <input type="password" class="form-control" id="mdp" name="mdp" required="required"/> </div> <!-- Password confirm --> <div class="form-group"> <label class="control-label" for="mdp2"> Confirmation Mot de passe</label> <input type="password" class="form-control" id="mdp2" name="mdp2" required="required"/> </div> <!-- Nom --> <div class="form-group"> <label class="control-label" for="Nom">Nom</label> <input type="text" value="<?php if (isset($nom)) { echo $nom; } ?>" class="form-control" id="nom" name="nom" required="required"/> </div> <!-- Prenom--> <div class="form-group"> <label class="control-label" for="prenom">Prenom</label> <input type="text" value="<?php if (isset($prenom)) { echo $prenom; } ?>" class="form-control" id="prenom" name="prenom" required="required"/> </div> <!-- Adresse--> <div class="form-group"> <label class="control-label" for="adresse">Adresse</label> <input type="text" value="<?php if (isset($adresse)) { echo $adresse; } ?>" class="form-control" id="adresse" name="adresse" required="required"/> </div> <!-- Email --> <div class="form-group"> <label class="control-label" for="email">Email</label> <input type="email" value="<?php if (isset($email)) { echo $email; } ?>" class="form-control" id="email" name="email" required="required"/> </div> <!-- Confirmation Email --> <div class="form-group"> <label class="control-label" for="email2">Confirmation Email</label> <input type="email" value="<?php if (isset($email2)) { echo $email2; } ?>" class="form-control" id="email2" name="email2" required="required"/> </div> <!-- Code postal --> <div class="form-group"> <label class="control-label" for="cp">Code postal</label> <input type="text" value="<?php if (isset($cp)) { echo $cp; } ?>" class="form-control" id="codePostal" name="cp" required="required"/> </div> <!--tel --> <div class="form-group"> <label class="control-label" for="telephone">Telephone</label> <input type="tel" value="<?php if (isset($tel)) { echo $tel; } ?>" class="form-control" id="tel" name="tel" required="required"/> </div> <!-- Fonction --> <div class="form-group"> <label class="control-label" for="fonction" id="fonction" >Fonction</label></br> <select name="fonction" size="3"> <option>Agent </option> <option>Gardien </option> <option>Coach </option> </select> </div> <label class="control-label"> Actif :</label><br> oui <INPUT type="checkbox" name="actif" value="valeur attachée au bouton"> non <INPUT type="checkbox" name="actif" value="valeur attachée au bouton"> <!-- Association --> <div class="form-group"> <label class="control-label" for="association" id="association">Association</label></br> <select name="idassociation" size="3"> <option>Les gardiens du nord</option> <option>Unissef</option> <option>CMS assos</option> </select> </div> <input type="submit" class="btn btn-primary" value="Valider" name="inscription"/> </form> </div><!-- /.container --> </div> <?php include ("partials/footer.php"); ?>
jordane45
Messages postés
38112
Date d'inscription
mercredi 22 octobre 2003
Statut
Modérateur
Dernière intervention
29 mars 2024
4 634
>
Anonymous95340
Messages postés
114
Date d'inscription
lundi 5 octobre 2015
Statut
Membre
Dernière intervention
7 décembre 2020
Modifié le 26 avril 2017 à 16:55
Modifié le 26 avril 2017 à 16:55
1 - Merci, dans les balises de code, de préciser le LANGAGE histoire qu'on puisse avoir la coloration syntaxique.
Explications disponibles ici :</souligne> https://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code
2 - Tu n'es pas très clair ..
Tu dis
Puis juste après:
Donc... au final .. tu le fais via du code (et non à la main :!! )
3 - Tu dis avoir une erreur.... LAQUELLE ? (message exact et COMPLET de l'erreur en question )
Explications disponibles ici :</souligne> https://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code
2 - Tu n'es pas très clair ..
Tu dis
Si justement j’insère les données a la main dans mes tables
Puis juste après:
Car dans mon formulaire d'inscription la table que j'utilise est personnelAssociatif
Cela m'affiche une erreur
page inscription ou il y a le codePHP
Donc... au final .. tu le fais via du code (et non à la main :!! )
3 - Tu dis avoir une erreur.... LAQUELLE ? (message exact et COMPLET de l'erreur en question )
Anonymous95340
Messages postés
114
Date d'inscription
lundi 5 octobre 2015
Statut
Membre
Dernière intervention
7 décembre 2020
1
3 mai 2017 à 18:26
3 mai 2017 à 18:26
Bonjour,
oui désole erreur de compréhension de ma part.
l'erreur que j'ai a chaque fois est : Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'Unissef' for column 'Association_idAssociation' at row 1' in C:\wamp64\www\m2lV1\inscription.php on line 47
( ! ) PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'Unissef' for column 'Association_idAssociation' at row 1 in C:\wamp64\www\m2lV1\inscription.php on line 47
oui désole erreur de compréhension de ma part.
l'erreur que j'ai a chaque fois est : Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'Unissef' for column 'Association_idAssociation' at row 1' in C:\wamp64\www\m2lV1\inscription.php on line 47
( ! ) PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'Unissef' for column 'Association_idAssociation' at row 1 in C:\wamp64\www\m2lV1\inscription.php on line 47
jordane45
Messages postés
38112
Date d'inscription
mercredi 22 octobre 2003
Statut
Modérateur
Dernière intervention
29 mars 2024
4 634
>
Anonymous95340
Messages postés
114
Date d'inscription
lundi 5 octobre 2015
Statut
Membre
Dernière intervention
7 décembre 2020
3 mai 2017 à 21:49
3 mai 2017 à 21:49
Bonjour,
Le message ne te parrait pas assez clair ?
Le message ne te parrait pas assez clair ?
Incorrect integer value: 'Unissef' for column 'Association_idAssociation'
17 avril 2017 à 20:22
J'ai essayer de faire ma base de données mais je coince au niveau de la clé étrangère.
17 avril 2017 à 21:12