ajout du dump de la base vide, un script de création de base et un

script à travailler pour l'insertion de données
This commit is contained in:
Jeremy MANSON 2018-12-20 21:52:35 +01:00
parent e1901a195f
commit 71410e3f73
3 changed files with 99 additions and 0 deletions

4
createdb.sql Normal file
View File

@ -0,0 +1,4 @@
CREATE DATABASE gestion_depenses;
CREATE USER 'gestdep'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON gestion_depenses.* to 'gestdep'@'localhost';
FLUSH PRIVILEGES;

80
gestion_depenses.sql Normal file
View File

@ -0,0 +1,80 @@
-- phpMyAdmin SQL Dump
-- version 4.6.6deb4
-- https://www.phpmyadmin.net/
--
-- Client : localhost:3306
-- Généré le : Jeu 20 Décembre 2018 à 21:30
-- Version du serveur : 10.1.37-MariaDB-0+deb9u1
-- Version de PHP : 7.0.33-0+deb9u1
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 */;
--
-- Base de données : `gestion_depenses`
--
-- --------------------------------------------------------
--
-- Structure de la table `gest_cat`
--
CREATE TABLE `gest_cat` (
`cat_date` datetime NOT NULL,
`cat_id` varchar(10) NOT NULL,
`cat_name` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Structure de la table `gest_cpt`
--
CREATE TABLE `gest_cpt` (
`cpt_date` int(11) NOT NULL,
`cpt_id` int(10) NOT NULL,
`cpt_name` int(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Structure de la table `gest_datas`
--
CREATE TABLE `gest_datas` (
`datas_dates_crea` datetime NOT NULL,
`datas_dates_op` date NOT NULL,
`datas_types` varchar(6) NOT NULL,
`datas_montants` int(11) NOT NULL,
`datas_mdp` varchar(10) NOT NULL,
`datas_cat` varchar(10) NOT NULL,
`datas_commentaires` text NOT NULL,
`datas_files` blob NOT NULL,
`datas_tags` varchar(10) NOT NULL,
`datas_comptes` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Structure de la table `gest_mdp`
--
CREATE TABLE `gest_mdp` (
`mdp_date` datetime NOT NULL,
`mdp_id` varchar(10) NOT NULL,
`mdp_name` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!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 */;

15
traitement.php Normal file
View File

@ -0,0 +1,15 @@
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=gestion_depenses;charset=utf8', 'gestdep', 'password');
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
// On ajoute une entrée dans la table jeux_video
$bdd->exec('INSERT INTO gest_datas(datas_cat, datas_commentaires, datas_comptes, datas_dates_crea, datas_dates_op, datas_mdp, datas_montants, datas_tags, datas_types) VALUES(\'1234567890\', \'Achat d un paquet de clope\', \'5555500000\', 20181220214000, 20181220, \'0987654321\', \'7.80\', \'#clopes\', \'sorties\' )');
echo 'operation ajouté !';
?>