Partage
  • Partager sur Facebook
  • Partager sur Twitter

Assurance + php

Sujet résolu
    19 mai 2019 à 16:41:16

    Bonjour,

    actuellement je suis a l'étape ou je test mon code !

    je pense que la meme erreur reviens a plusieurs endroit ... mais je ne sais pas ou ...

    voici mes class :

    <?php
    /**
     * Created by PhpStorm.
     * User: Adeline
     * Date: 16/02/2019
     * Time: 00:33
     */
    
    class Assurance {
    
    	protected $id;
    	protected $nom;
    	protected $codePostal;
    	protected $email;
    	protected $ville;
    	protected $telephone;
    	protected $pays;
    	protected $numAssurer;
    	protected $adresse1;
    	protected $adresse2;
    
    	public function __construct( array $array =[] )
    	{
    		$this->hydrate($array);
    	}
    
    
    	public function getId() {
    		return $this->id;
    	}
    
    
    	public function getNom() {
    		return $this->nom;
    	}
    
    
    	public function getCodePostal() {
    		return $this->codePostal;
    	}
    
    
    	public function getEmail() {
    		return $this->email;
    	}
    
    
    	public function getVille() {
    		return $this->ville;
    	}
    
    
    	public function getTelephone() {
    		return $this->telephone;
    	}
    
    
    	public function getPays() {
    		return $this->pays;
    	}
    
    
    	/**
    	 * @return mixed
    	 */
    	public function getNumAssurer() {
    		return $this->numAssurer;
    	}
    
    	/**
    	 * @return mixed
    	 */
    	public function getAdresse1() {
    		return $this->adresse1;
    	}
    
    	/**
    	 * @return mixed
    	 */
    	public function getAdresse2() {
    		return $this->adresse2;
    	}
    
    
    
    
    	public function setId( $id ) {
    		echo '<br>[debug]Dans "'.__FUNCTION__.'" [/debug]';
    		$id = (int) $id;
    		if ($id > 0)
    		{
    			$this->id = $id;
    		}
    	}
    
    
    	public function setNom( $nom ) {
    		if (strlen(trim($nom)) > 0)
    			//strlen = Calcule la taille d'une chaîne
    			// trim = Supprime les espaces (ou d'autres caractères) en début et fin de chaîne
    		{
    			if (strpos($nom,"#") !== false)
    				// strpos = Cherche la position de la première occurrence dans une chaîne
    			{
    				throw new Exception("Le nom ne peut pas avoir de caracteres speciaux");
    			}
    			if (preg_match("/[0-9]/", "$nom"))
    				// preg_match = sert ici pour les cfiffres
    			{
    				throw new Exception("Le nom ne peut pas avoir de chiffre");
    			}
    			else
    			{
    				//echo "la chaîne $nom est correcte";
    				$this->nom = $nom;
    			}
    		}
    
    	}
    
    
    	public function setCodePostal( $codePostal ) {
    		if (preg_match('/[0-9]{5}/',$codePostal))
    		{
    			$this->codePostal = $codePostal;
    		} else {
    			echo "<br/>Aucun r&eacute;sultat n'a &eacute;t&eacute; trouv&eacute;.";
    		}
    	}
    
    
    	public function setEmail( $email ) {
    		//1) si la chaine n'est pas vide
    		if (strlen(trim($email)) == 0) {
    			//erreur
    			throw new LengthException("Le mail est vide",100); //code 100 == mail vide
    		} else {
    			//pas d'erreur on continue
    // 			if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
    // 				//mail validé
    			$this->email = $email;
    // 			} else {
    // 				//erreur à gérer
    // 				throw new Exception("Le mail est invalide",101); //code 101 == mail invalide
    // 			}
    		}
    	}
    
    
    	public function setVille( $ville ) {
    		if (strlen(trim($ville)) > 0)
    		{
    			$this->ville = $ville;
    
    			if (preg_match("/[0-9]/", "$ville"))
    			{
    				throw new Exception("La ville ne peut pas avoir de chiffre");
    			}
    
    		}else{
    			echo "la ville est obligatoire";
    		}
    	}
    
    
    	public function setTelephone( $telephone ) {
    		$this->telephone = $telephone;
    	}
    
    	public function setPays( $pays ) {
    		if (strlen(trim($pays)) > 0)
    		{
    			$this->pays = $pays;
    
    			if (preg_match("/[0-9]/", "$pays"))
    			{
    				throw new Exception("La ville ne peut pas avoir de chiffre");
    			}
    
    		}else{
    			echo "le pays est obligatoire";
    		}
    	}
    
    
    	/**
    	 * @param mixed $numAssurer
    	 */
    	public function setNumAssurer( $numAssurer ) {
    		$this->numAssurer = $numAssurer;
    	}
    
    	/**
    	 * @param mixed $adresse1
    	 */
    	public function setAdresse1( $adresse1 ) {
    		$this->adresse1 = $adresse1;
    	}
    
    	/**
    	 * @param mixed $adresse2
    	 */
    	public function setAdresse2( $adresse2 ) {
    		$this->adresse2 = $adresse2;
    	}
    
    
    
    	protected function hydrate($array){
    		echo '<br>[debug]Dans "'.__FUNCTION__.'" [/debug]';
    		foreach ($array as $key => $value) {
    			$methodName = 'set'.ucfirst($key);
    			if(method_exists($this, $methodName)){
    				$this->$methodName($value);
    			}
    		}
    	}
    
    
    
    
    }
    <?php
    /**
     * Created by PhpStorm.
     * User: Adeline
     * Date: 19/02/2019
     * Time: 19:09
     */
    
    class Assurance_habitation extends Assurance {
    
    	protected $id;
    	protected $assurance;
    
    	public function __construct( array $data =[] )
    	{
    		//appel du constructeur parent puisqu'on est h�rit� de ...
    		parent::__construct($data);
    	}
    
    	/**
    	 * @return mixed
    	 */
    	public function getId() {
    		return $this->id;
    	}
    
    	/**
    	 * @return mixed
    	 */
    	public function getAssurance() {
    		return $this->assurance;
    	}
    
    
    	/**
    	 * @param mixed $id_habitation
    	 */
    	public function setId( $id ) {
    		echo '<br>[debug]Dans "'.__FUNCTION__.'" [/debug]';
    		$id = (int) $id;
    		if ($id > 0)
    		{
    			$this->id_habitation = $id;
    		}
    	}
    
    	/**
    	 * @param mixed $assurance
    	 */
    	public function setAssurance( $assurance ) {
    		$this->assurance = $assurance;
    	}
    
    
    
    
    }

    voici mes manager assurance :

    <?php
    
    
    class ManagerAssurance extends Manager{
    	public function __construct( $mode = 'prod' ) {
    		debug( '<br>[debug]Dans "' . __CLASS__ . "::" . __FUNCTION__ . '" [/debug]', true );
    		parent::__construct( $mode );
    	}
    
    
    	public function read( $id ) {
    		echo '<br>[debug]Dans "' . __FUNCTION__ . '" [/debug]';
    		$req = $this->db->prepare( 'SELECT * FROM assurance WHERE id =:id' );
    		$req->bindValue( 'id', $id, PDO::PARAM_INT );
    		$req->execute();
    		$array= $req->fetch();
    		$oAssurance = new assurance( $array );
    
    		return $oAssurance;
    	}
    
    	public function add( $data ) {
    		echo '<br>[debug]Dans "' . __FUNCTION__ . '" [/debug]';
    		//bloc try/catch pour g�rer les exceptions
    		//provenant de Employer
    		try {
    			$oAssurance = new assurance( $data );
    		} catch ( LengthException $lengthException ) {
    			//cas longueur == 0
    			throw new Exception( $lengthException->GetMessage(), $lengthException->GetCode() );
    		} catch ( Exception $exception ) {
    			//autre cas (mais pour nous invalide)
    			throw new Exception( $exception->GetMessage(), $exception->GetCode() );
    		}
    		$req = $this->db->prepare( 'INSERT INTO assurance (nom,codePostal,email,ville,telephone,pays,numAssurer,adresse1,adresse2) VALUES(:nom,:codePostal,:email,:ville,:telephone,:pays,:typeassurance,:numAssurer,:adresse1,:adresse2)' );
    		$req->bindValue( 'nom', $oAssurance->getNom(), PDO::PARAM_STR );
    		$req->bindValue( 'codePostal', $oAssurance->getCodePostal(), PDO::PARAM_STR );
    		$req->bindValue( 'email', $oAssurance->getEmail(), PDO::PARAM_STR );
    		$req->bindValue( 'ville', $oAssurance->getVille(), PDO::PARAM_STR );
    		$req->bindValue( 'telephone', $oAssurance->getTelephone(), PDO::PARAM_STR );
    		$req->bindValue( 'pays', $oAssurance->getPays(), PDO::PARAM_STR );
    		$req->bindValue( 'numAssurer', $oAssurance->getNumAssurer(), PDO::PARAM_STR );
    		$req->bindValue( 'adresse1', $oAssurance->getAdresse1(), PDO::PARAM_STR );
    		$req->bindValue( 'adresse2', $oAssurance->getAdresse2(), PDO::PARAM_STR );
    		$req->execute();
    		$id = $this->db->lastInsertId();
    		$oAssurance->setId( $id );
    	}
    
    	public function getAllAssurance() {
    		$stm = "SELECT * FROM assurance";
    		//Ceci:
    //         $stmt = $this->connexion->query($req);
    //         return $stmt;
    		//resum� par cela
    		return $this->db->query( $stm );
    	}
    
    	public function getAssurance( $id ) {
    		$stm = "SELECT * FROM assurance WHERE id=:id";
    		//preparation == protection des donn?es ? venir
    		$stmt = $this->db->prepare( $stm );
    		//liaison des marqueur :toto aux donnees
    		$stmt->bindValue( 'id', $id, PDO::PARAM_INT );
    		//execution de la requete sur le serveur SQL
    		$stmt->execute();
    
    		return $stmt;
    	}
    
    	public function update( $data ) {
    		echo '<pre>' . print_r( $data, true ) . '</pre>';
    
    		echo '<br>[debug]SESSION';
    		echo '<pre>' . print_r( $data, true ) . '</pre>';
    
    		$req = $this->db->prepare( 'UPDATE assurance SET nom=:nom,codePostal=:codePostal,email=:email,ville=:ville,telephone=:telephone,pays=:pays,numAssurer=:numAssurer,adresse1=:adresse1,adresse2=:adresse2 WHERE id =:id' );
    		$req->bindValue( 'id', $data->getId(), PDO::PARAM_INT );
    		$req->bindValue( 'nom', $data->getNom(), PDO::PARAM_STR );
    		$req->bindValue( 'codePostal', $data->getCodePostal(), PDO::PARAM_STR );
    		$req->bindValue( 'email', $data->getEmail(), PDO::PARAM_STR );
    		$req->bindValue( 'ville', $data->getVille(), PDO::PARAM_STR );
    		$req->bindValue( 'telephone', $data->getTelephone(), PDO::PARAM_STR );
    		$req->bindValue( 'pays', $data->getPays(), PDO::PARAM_STR );
    		$req->bindValue( 'numAssurer', $data->getNumAssurer(), PDO::PARAM_STR );
    		$req->bindValue( 'adresse1', $data->getAdresse1(), PDO::PARAM_STR );
    		$req->bindValue( 'adresse2', $data->getAdresse2(), PDO::PARAM_STR );
    
    		if ( ! $req->execute() ) {
    			echo "<br>[debug] Erreur";
    		}
    	}
    
    	public function delete( $id ) {
    		// =>voir  getLivre(id) pour modele
    		$req  = "DELETE FROM assurance WHERE id=:id";
    		$stmt = $this->db->prepare( $req );
    		$stmt->execute();
    		if ( $stmt->rowCount() == 1 ) {
    			echo '[debug]OK 1 ligne inseree';
    		} else {
    			echo 'Erreur insertion donnees';
    		}
    	}
    }
    <?php
    /**
     * Created by PhpStorm.
     * User: Adeline
     * Date: 21/02/2019
     * Time: 14:29
     */
    
    class ManagerAssurance_habitation extends ManagerAssurance {
    
    	public function __construct( $mode = 'prod' ) {
    		debug('<br>[debug]Dans "'.__CLASS__."::".__FUNCTION__.'" [/debug]',true);
    		parent::__construct( $mode );
    	}
    
    
    
    
    	public function read($id){
    		echo '<br>[debug]Dans "'.__FUNCTION__.'" [/debug]';
    		$req = $this->db->prepare('SELECT * FROM Assurance_habitation WHERE id =:id');
    		$req->bindValue('id', $id, PDO::PARAM_INT);
    		$req->execute();
    		$array = $req->fetch();
    		$oAssurance_habitation = new assurance_habitation($array);
    
    		return $oAssurance_habitation;
    	}
    
    	public function add( $data ) {
    		echo '<br>[debug]Dans "' . __FUNCTION__ . '" [/debug]';
    		//bloc try/catch pour g�rer les exceptions
    		//provenant de Employer
    		try {
    			$oAssurance_habitation = new assurance_habitation( $data );
    		} catch ( LengthException $lengthException ) {
    			//cas longueur == 0
    			throw new Exception( $lengthException->GetMessage(), $lengthException->GetCode() );
    		} catch ( Exception $exception ) {
    			//autre cas (mais pour nous invalide)
    			throw new Exception( $exception->GetMessage(), $exception->GetCode() );
    		}
    		$req = $this->db->prepare( 'INSERT INTO Assurance_habitation (assurance) VALUES(:assurance)' );
    		$req->bindValue('numAssurer', $oAssurance_habitation->getAssurance(), PDO::PARAM_INT );
    		$req->execute();
    		$id = $this->db->lastInsertId();
    		$oAssurance_habitation->setId( $id );
    	}
    
    	public function getAllHabitation() {
    		$stm = "SELECT * FROM assurance_habitation";
    		//Ceci:
    //         $stmt = $this->connexion->query($req);
    //         return $stmt;
    		//resum� par cela
    		return $this->db->query($stm);
    	}
    
    	public function getHabitation($id) {
    		$stm = "SELECT * FROM assurance_habitation WHERE id=:id";
    		//preparation == protection des donn?es ? venir
    		$stmt = $this->db->prepare($stm);
    		//liaison des marqueur :toto aux donnees
    		$stmt->bindValue('id',$id,PDO::PARAM_INT);
    		//execution de la requete sur le serveur SQL
    		$stmt->execute();
    		return $stmt;
    	}
    
    	public function update($data){
    		echo '<pre>'.print_r($data,true).'</pre>';
    
    		echo '<br>[debug]SESSION';
    		echo '<pre>'.print_r($data,true).'</pre>';
    
    		$req = $this->db->prepare('UPDATE assurance_habitation SET assurance=:assurance WHERE id=:id');
    		$req->bindValue('id', $data->getId(), PDO::PARAM_INT);
    		$req->bindValue('assurance', $data->getAssurance(), PDO::PARAM_INT );
    		if (! $req->execute()) {
    			echo "<br>[debug] Erreur";
    		}
    	}
    
    	public function delete($id) {
    		// =>voir  getLivre(id) pour modele
    		$req = "DELETE FROM assurance_habitation WHERE id=:id";
    		$stmt = $this->db->prepare($req);
    		$stmt->execute();
    		if ($stmt->rowCount() == 1) {
    			echo '[debug]OK 1 ligne inseree';
    		} else {
    			echo 'Erreur insertion donnees';
    		}
    
    	}
    
    }

    voici le code que je test : 

    <?php
    
    
    debug( $_POST, true );
    
    echo '<pre>' . print_r( $_POST, true ) . '</pre>';
    $_GET['page'] = 'connexion';
    if ( ! empty( $_POST ) ) {
    	if ( ! isset(
    		$_POST['nom'],
    		$_POST['codePostal'],
    		$_POST['email'],
    		$_POST['ville'],
    		$_POST['telephone'],
    		$_POST['pays'],
    		$_POST['numAssurer'],
    		$_POST['adresse1'],
    		$_POST['adresse2'],
    		$_POST['assurance']) ) {
    
    		echo "il manque une ou plusieurs donnees";
    
    	} else {
    		//remont� dans l'index
    		// 		require_once '../../include/autoload.php';
    		try {
    			$oManagerAssurance_habitation = new ManagerAssurance_habitation(); //cr�aton d'un objet manager
    			$oManagerAssurance_habitation->setDb( $db ); // on passe la connexion � l'objet manager
    			$oManagerAssurance_habitation->add( $_POST );
    			$Assurance_habitation = $oManagerAssurance_habitation->getAllHabitation();
    
    			$_GET['page'] = 'accueil';
    		} catch ( LengthException $lengthException ) {
    //cas longueur == 0
    			echo $lengthException->GetMessage();
    		} catch ( Exception $exception ) {
    //aute cas (mais pour nous invalide)
    			echo $exception->GetMessage();
    		}
    		header("Location: index.php?page=completez_profil");
    
    	}
    }
    ?>
    
    <div class="row align-items-start">
    	<div class="col-12 col-md-8 unis_volontaire">
    		<section class="page-section">
    			<form action="?page=profil_AssuranceHabitationInscription" method="post">
    
    				<div class="form-group">
    					<label for="nom"> Nom : </label><input type="text" class="form-control" aria-describedby="nom"  id="nom" name="nom">
    				</div>
    				<span id="nom_manquant">
                        </span>
    
    				<div class="form-group">
    					<label for="codePostal"> Code Postal : </label><input type="text" class="form-control" aria-describedby="code Postal"  id="codePostal" name="codePostal">
    				</div>
    				<span id="code_manquant">
                        </span>
    
    				<div class="form-group">
    					<label for="email"> email : </label><input type="email" class="form-control" aria-describedby="email"  id="email" name="email">
    				</div>
    				<span id="email_manquant">
                        </span>
    
    				<div class="form-group">
    					<label for="ville"> ville : </label><input type="text" class="form-control" aria-describedby="ville"  id="ville" name="ville">
    				</div>
    				<span id="ville_manquant">
                        </span>
    
    				<div class="form-group">
    					<label for="telephone"> telephone : </label><input type="text" class="form-control" aria-describedby="telephone"  id="telephone" name="telephone">
    				</div>
    				<span id="telephone_manquant">
                        </span>
    
    				<div class="form-group">
    					<label for="pays"> Pays : </label><input type="text" class="form-control" aria-describedby="pays"  id="pays" name="pays">
    				</div>
    
    				<div class="form-group">
    					<label for="numAssurer"> Num�ro d'assurer : </label><input type="text" class="form-control" aria-describedby="numAssurer"  id="numAssurer" name="numAssurer">
    				</div>
    
    				<div class="form-group">
    					<label for="adresse1"> adresse : </label><input type="text" class="form-control" aria-describedby="adresse1"  id="adresse1" name="adresse1">
    				</div>
    				<span id="adresse1_manquant">
                        </span>
    
    				<div class="form-group">
    					<label for="adresse2"> adresse : </label><input type="text" class="form-control" aria-describedby="adresse2"  id="adresse2" name="adresse2">
    				</div>
    
    				<p>
    					<input type="submit" name="inscription" id="button" class="btn-inscrit" value="enregistrer">
    				</p>
    
    			</form>
    		</section>
    
    	</div>
    </div>
    
    
    

    voici ma base : 

    -- phpMyAdmin SQL Dump
    -- version 4.8.0.1
    -- https://www.phpmyadmin.net/
    --
    -- Hôte : 127.0.0.1:3306
    -- Généré le :  Dim 19 mai 2019 à 14:37
    -- Version du serveur :  5.7.21
    -- Version de PHP :  7.2.4
    
    SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
    SET AUTOCOMMIT = 0;
    START TRANSACTION;
    SET time_zone = "+00:00";
    
    
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8mb4 */;
    
    --
    -- Base de données :  `uniscite`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `assurance`
    --
    
    DROP TABLE IF EXISTS `assurance`;
    CREATE TABLE IF NOT EXISTS `assurance` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `nom` varchar(50) NOT NULL,
      `codePostal` varchar(5) NOT NULL,
      `email` varchar(500) NOT NULL,
      `ville` varchar(500) NOT NULL,
      `telephone` varchar(500) NOT NULL,
      `pays` varchar(500) NOT NULL,
      `numAssurer` varchar(50) NOT NULL,
      `adresse1` varchar(500) NOT NULL,
      `adresse2` varchar(500) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `assurance_habitation`
    --
    
    DROP TABLE IF EXISTS `assurance_habitation`;
    CREATE TABLE IF NOT EXISTS `assurance_habitation` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `assurance` int(11) DEFAULT '3',
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `assurance_vehicule`
    --
    
    DROP TABLE IF EXISTS `assurance_vehicule`;
    CREATE TABLE IF NOT EXISTS `assurance_vehicule` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `assurance` int(11) DEFAULT '1',
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `assurance_vie`
    --
    
    DROP TABLE IF EXISTS `assurance_vie`;
    CREATE TABLE IF NOT EXISTS `assurance_vie` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `assurance` int(11) DEFAULT '2',
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `assure`
    --
    
    DROP TABLE IF EXISTS `assure`;
    CREATE TABLE IF NOT EXISTS `assure` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `assurance` int(11) DEFAULT '0',
      `employe` int(11) DEFAULT '0',
      `volontaire` int(11) DEFAULT '0',
      PRIMARY KEY (`id`),
      KEY `assurance` (`assurance`),
      KEY `employe` (`employe`),
      KEY `volontaire` (`volontaire`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `employe`
    --
    
    DROP TABLE IF EXISTS `employe`;
    CREATE TABLE IF NOT EXISTS `employe` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `password` varchar(500) NOT NULL,
      `nom` varchar(100) NOT NULL,
      `prenom` varchar(100) NOT NULL,
      `adresse1` varchar(500) NOT NULL,
      `adresse2` varchar(500) NOT NULL,
      `codePostal` varchar(5) NOT NULL,
      `email` varchar(500) NOT NULL,
      `ville` varchar(500) NOT NULL,
      `telephone` varchar(15) NOT NULL,
      `pays` varchar(15) NOT NULL,
      `handicap` varchar(150) NOT NULL,
      `permis` varchar(150) NOT NULL,
      `vehicule` varchar(3) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
    
    --
    -- Déchargement des données de la table `employe`
    --
    
    INSERT INTO `employe` (`id`, `password`, `nom`, `prenom`, `adresse1`, `adresse2`, `codePostal`, `email`, `ville`, `telephone`, `pays`, `handicap`, `permis`, `vehicule`) VALUES
    (1, '$2y$10$6juUOz1aLq6RyUyoXoROB.R13LjARAMQdbZwGDWVrpYr.cb4xt1eG', 'ddd', 'dffds', '4 tuope', 'rme', '65402', 'toto@gmail.com', 'pau', '0875652135', 'gre', 'oui', 'b', 'rte');
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `possede`
    --
    
    DROP TABLE IF EXISTS `possede`;
    CREATE TABLE IF NOT EXISTS `possede` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `vehicule` int(11) DEFAULT '0',
      `employe` int(11) DEFAULT '0',
      `volontaire` int(11) DEFAULT '0',
      PRIMARY KEY (`id`),
      KEY `employe` (`employe`),
      KEY `volontaire` (`volontaire`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `reunion`
    --
    
    DROP TABLE IF EXISTS `reunion`;
    CREATE TABLE IF NOT EXISTS `reunion` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `date` datetime NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `reunion_employe`
    --
    
    DROP TABLE IF EXISTS `reunion_employe`;
    CREATE TABLE IF NOT EXISTS `reunion_employe` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `reunion` int(11) DEFAULT '0',
      `employe` int(11) DEFAULT '0',
      `volontaire` int(11) DEFAULT '0',
      PRIMARY KEY (`id`),
      KEY `reunion` (`reunion`),
      KEY `employe` (`employe`),
      KEY `volontaire` (`volontaire`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `vehicule`
    --
    
    DROP TABLE IF EXISTS `vehicule`;
    CREATE TABLE IF NOT EXISTS `vehicule` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `nom` varchar(500) NOT NULL,
      `type_vehicule` varchar(500) NOT NULL,
      `immatriculation` varchar(500) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
    
    --
    -- Déchargement des données de la table `vehicule`
    --
    
    INSERT INTO `vehicule` (`id`, `nom`, `type_vehicule`, `immatriculation`) VALUES
    (1, 'kjh', 'pou', '2162');
    
    -- --------------------------------------------------------
    
    --
    -- Structure de la table `volontaire`
    --
    
    DROP TABLE IF EXISTS `volontaire`;
    CREATE TABLE IF NOT EXISTS `volontaire` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `pre_inscrit` varchar(50) DEFAULT '1',
      `nom` varchar(100) NOT NULL,
      `prenom` varchar(100) NOT NULL,
      `adresse1` varchar(500) NOT NULL,
      `adresse2` varchar(500) NOT NULL,
      `codePostal` varchar(5) NOT NULL,
      `email` varchar(500) NOT NULL,
      `ville` varchar(500) NOT NULL,
      `telephone` varchar(15) NOT NULL,
      `pays` varchar(15) NOT NULL,
      `handicap` varchar(150) NOT NULL,
      `permis` varchar(150) NOT NULL,
      `vehicule` varchar(3) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    --
    -- Contraintes pour les tables déchargées
    --
    
    --
    -- Contraintes pour la table `assure`
    --
    ALTER TABLE `assure`
      ADD CONSTRAINT `assure_ibfk_1` FOREIGN KEY (`assurance`) REFERENCES `assurance` (`id`),
      ADD CONSTRAINT `assure_ibfk_2` FOREIGN KEY (`employe`) REFERENCES `employe` (`id`),
      ADD CONSTRAINT `assure_ibfk_3` FOREIGN KEY (`volontaire`) REFERENCES `volontaire` (`id`);
    
    --
    -- Contraintes pour la table `possede`
    --
    ALTER TABLE `possede`
      ADD CONSTRAINT `possede_ibfk_1` FOREIGN KEY (`employe`) REFERENCES `employe` (`id`),
      ADD CONSTRAINT `possede_ibfk_2` FOREIGN KEY (`volontaire`) REFERENCES `volontaire` (`id`);
    
    --
    -- Contraintes pour la table `reunion_employe`
    --
    ALTER TABLE `reunion_employe`
      ADD CONSTRAINT `reunion_employe_ibfk_1` FOREIGN KEY (`reunion`) REFERENCES `reunion` (`id`),
      ADD CONSTRAINT `reunion_employe_ibfk_2` FOREIGN KEY (`employe`) REFERENCES `employe` (`id`),
      ADD CONSTRAINT `reunion_employe_ibfk_3` FOREIGN KEY (`volontaire`) REFERENCES `volontaire` (`id`);
    COMMIT;
    
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    

    merci pour votre aide

    • Partager sur Facebook
    • Partager sur Twitter

    Merci à tous. Vous pouvez me retrouver ici :

    🌐 Visitez mon profil sur Comeup

    🚀 Découvrez BeFreelancr

    📱 Retrouvez-moi sur LinkedIn

      19 mai 2019 à 17:26:15

      "La même erreur" "je ne sais pas ou"

      Quelle erreur ?
      • Partager sur Facebook
      • Partager sur Twitter
        19 mai 2019 à 17:31:13

        ah oui effectivement =) désolé j'ai été un peut spide sur ce coup la =)

        Array
        (
            [nom] => kjh
            [codePostal] => 65402
            [email] => test@test.test
            [ville] => pau
            [telephone] => 0875652135
            [pays] => gre
            [numAssurer] => 458762
            [adresse1] => 4 tuope
            [adresse2] => rme
            [inscription] => enregistrer
        )
        
        Array
        (
            [nom] => kjh
            [codePostal] => 65402
            [email] => test@test.test
            [ville] => pau
            [telephone] => 0875652135
            [pays] => gre
            [numAssurer] => 458762
            [adresse1] => 4 tuope
            [adresse2] => rme
            [inscription] => enregistrer
        )
        

        il manque une ou plusieurs donnees

        • Partager sur Facebook
        • Partager sur Twitter

        Merci à tous. Vous pouvez me retrouver ici :

        🌐 Visitez mon profil sur Comeup

        🚀 Découvrez BeFreelancr

        📱 Retrouvez-moi sur LinkedIn

        Assurance + php

        × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
        × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
        • Editeur
        • Markdown