Sous WampServer, accédez à "phpMyAdmin". Cliquez sur "Base de données" et créer une base de données nommé "FREE" avec un interclassement en "latin1_general-ci". La base de données "free" a été créé et apparait maintenant dans le menu de gauche. Cliquez dessus puis allez sur l'onglet "SQL". Dans le champ qui apparait, faites un copié/collé des tables ci-dessous puis cliquez sur "Exécuter".
-- --------------------------------------------------------
 
--
-- Structure de la table `accueil`
--
 
CREATE TABLE IF NOT EXISTS `accueil` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `titre` text COLLATE latin1_general_ci NOT NULL,
  `description` text COLLATE latin1_general_ci NOT NULL,
  `texte` text COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;
 
-- --------------------------------------------------------
 
--
-- Structure de la table `categories`
--
 
CREATE TABLE IF NOT EXISTS `categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nom_categorie` text COLLATE latin1_general_ci NOT NULL,
  `description_categorie` text COLLATE latin1_general_ci NOT NULL,
  `titre_rewrite` text COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;
 
-- --------------------------------------------------------
 
--
-- Structure de la table `commentaire`
--
 
CREATE TABLE IF NOT EXISTS `commentaire` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_page` int(11) NOT NULL,
  `pseudo` text COLLATE latin1_general_ci NOT NULL,
  `email` VARCHAR(50) COLLATE latin1_general_ci NOT NULL,
  `commentaire` text COLLATE latin1_general_ci NOT NULL,
  `ip` text COLLATE latin1_general_ci NOT NULL,
  `DATE` int(11) NOT NULL,
  `validation` enum('0','1','2') COLLATE latin1_general_ci NOT NULL,
  `suivre_sujet` VARCHAR(3) COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;
 
-- --------------------------------------------------------
 
--
-- Structure de la table `contenu`
--
 
CREATE TABLE IF NOT EXISTS `contenu` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_categorie` int(11) NOT NULL,
  `titre` text COLLATE latin1_general_ci NOT NULL,
  `description` text COLLATE latin1_general_ci NOT NULL,
  `texte` text COLLATE latin1_general_ci NOT NULL,
  `DATE` int(11) NOT NULL,
  `titre_rewrite` text COLLATE latin1_general_ci NOT NULL,
  `valide` text COLLATE latin1_general_ci NOT NULL,
  `commentaire` text COLLATE latin1_general_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;
base de données
La base de données est maintenant créé .

Dans la foulé, nous allons créer un fichier de connexion à la base de données que nous allons nommé "connexion_bd.php".
Ouvrez Notepad++, sélectionnez comme langage "PHP" et insérez le code suivant :
<?php
//fonction de connexion à la bd
function connexion_bd(){
 
    $nom_du_serveur ="localhost";
    $nom_de_la_base ="FREE";
    $nom_utilisateur ="root";
    $passe ="";
 
    $link = mysql_connect ($nom_du_serveur,$nom_utilisateur,$passe) or die ('Erreur : '.mysql_error());
    mysql_select_db($nom_de_la_base, $link) or die ('Erreur :'.mysql_error());
}
function close_bd()
{
    mysql_close();
}
?>
Enregistrez le fichier dans le dossier "FREE" sous Wamp.
Information : le code ci-dessus est une simple fonction de connexion et de fermeture à la base de données.

A cette étape du tutoriel nous avons donc dans le dossier "FREE" sous Wamp, 2 dossiers (fckeditor et fckfinder) et un fichier (connexion_bd.php).

Catégorie CMS spécial free

Commentaire sur : Création de la base de données