Je fais l'insertion des donnees de quelques livres, afin de le lire en ligne, et effectuer bien sur des recherches, la structure du livre est comme suite:
+ Chapitre
++ Les Paragraphes ( Je fais l'insertion des donnees par paragraphe)
+++ Page
Par exemple:
+Chapitre 1:
++Paragraphe1
++Paragraphe2
++Paragraphe3
++Paragraphe4
+++Page1
+Chapitre 2:
++Paragraphe1
++Paragraphe2
++Paragraphe3
++Paragraphe4
+++Page2
+Chapitre 3:
++Paragraphe1
++Paragraphe2
+Chapitre 4:
++Paragraphe1
++Paragraphe2
+++Page3
Regarder le dernier exemple, deux chapitres ont la meme page, comment puis je utiliser ma requete afin d'obtenir cette structure, toutes mes requetes me donnent:
+Chapitre 3:
++Paragraphe1
++Paragraphe2
++Paragraphe1
++Paragraphe2
+++Page3
OU BIEN
+Chapitre 4:
++Paragraphe1
++Paragraphe2
++Paragraphe1
++Paragraphe2
+++Page3
Voila la structure de la table:
Code : Tout sélectionner
CREATE TABLE IF NOT EXISTS `livres` (
`id_livre` int(3) NOT NULL,
`paragraf` text collate utf8_unicode_ci NOT NULL,
`num_par` int(3) NOT NULL,
`page` int(3) NOT NULL,
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Ce que l'on apprend par l'effort reste toujours ancré beaucoup plus longtemps.