From 55248df2bb0de5261b14a9f78bcec187e55a252c Mon Sep 17 00:00:00 2001 From: lionel Date: Thu, 22 Jun 2017 09:08:26 +0200 Subject: [PATCH] renommage des fichiers, ajout du script sql initial et README --- README.md | 7 +++ film-creation.php => film-form-handler.php | 5 +- form-film.php => film-form.php | 2 +- film-list.php | 2 +- resources/film.sql | 72 ++++++++++++++++++++++ 5 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 README.md rename film-creation.php => film-form-handler.php (90%) rename form-film.php => film-form.php (95%) create mode 100644 resources/film.sql diff --git a/README.md b/README.md new file mode 100644 index 0000000..29d738f --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# afpa-bay +Premier projet php + +## Installation +Créer une base de de donnée, importer le script `resources/film.sql`. +Adapter les url de connexion dans les scripts + diff --git a/film-creation.php b/film-form-handler.php similarity index 90% rename from film-creation.php rename to film-form-handler.php index 4d55841..188fef2 100644 --- a/film-creation.php +++ b/film-form-handler.php @@ -24,15 +24,16 @@ //tout va bien echo 'cool!, film ajouté à la liste retour à la liste'; }else{ - echo '

ptit soucis ici!

'; + echo '

ptit soucis ici, un champ semble foireux!

'; print_r($bdd->errorInfo()); + require('film-form.php'); } //$pdo->lastInsertId(); }else{ //ya un pb, tous les champs ne sont pas renseignés echo '

tous les champs sont obligatoires

'; - require('form-film.php'); + require('film-form.php'); } diff --git a/form-film.php b/film-form.php similarity index 95% rename from form-film.php rename to film-form.php index 13d20a8..e83f0d1 100644 --- a/form-film.php +++ b/film-form.php @@ -1,5 +1,5 @@ -
+
Nouveau film diff --git a/film-list.php b/film-list.php index 3ae5b89..e7a7a4c 100644 --- a/film-list.php +++ b/film-list.php @@ -34,7 +34,7 @@ ?>

Liste des films

- ajouter un film + ajouter un film diff --git a/resources/film.sql b/resources/film.sql new file mode 100644 index 0000000..d47f990 --- /dev/null +++ b/resources/film.sql @@ -0,0 +1,72 @@ +-- phpMyAdmin SQL Dump +-- version 4.6.6deb4 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost:3306 +-- Generation Time: Jun 22, 2017 at 08:54 AM +-- Server version: 5.7.18-0ubuntu0.17.04.1 +-- PHP Version: 7.0.18-0ubuntu0.17.04.1 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +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 */; + +-- +-- Database: `afpa-bay` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `film` +-- + +CREATE TABLE `film` ( + `id` int(11) NOT NULL, + `titre` varchar(256) NOT NULL, + `auteur` varchar(256) NOT NULL, + `acteurs` varchar(1024) NOT NULL, + `date_sortie` year(4) NOT NULL, + `thumbnail` varchar(256) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `film` +-- + +INSERT INTO `film` (`id`, `titre`, `auteur`, `acteurs`, `date_sortie`, `thumbnail`) VALUES +(1, 'Bernie', 'Dupontel Albert', 'Dupontel Albert', 1996, 'http://fr.web.img6.acsta.net/medias/nmedia/18/64/13/46/18754633.jpg'), +(2, 'sdf', 'sdf', 'sdf', 2011, NULL), +(3, 'sdcsd', 'sdc', 'sdc', 2015, NULL), +(4, 'sdcsd', 'sdc', 'sdc', 2015, NULL), +(5, 'rturtu', 'rtutru', 'rtutr', 2005, NULL), +(6, 'kikou des bois', 'zonote', 'talui', 2005, NULL), +(7, 'sdcsdsdcsd', 'sdcsdcsdc', 'sdcsdcsdcdc', 2004, NULL); + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `film` +-- +ALTER TABLE `film` + ADD PRIMARY KEY (`id`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `film` +-- +ALTER TABLE `film` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; +/*!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 */;