Building a Content Management System with PEAR - Tables
(Page 3 of 4 )
Author's Table
# phpMyAdmin SQL Dump
# version 2.5.7-pl1
# http://www.phpmyadmin.net
#
# Host: localhost
# Generation Time: Jun 28, 2008 at 02:05 PM
# Server version: 5.0.51
# PHP Version: 5.2.6
#
# Database : `cms`
#
# --------------------------------------------------------
#
# Table structure for table `authors`
#
CREATE TABLE `authors` (
`aid` int(4) NOT NULL auto_increment,
`name` varchar(20) NOT NULL,
PRIMARY KEY (`aid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
#
# Dumping data for table `authors`
#
INSERT INTO `authors` VALUES (1, 'David Web');
INSERT INTO `authors` VALUES (2, 'Joe Blogg');
INSERT INTO `authors` VALUES (3, 'John Smith');
INSERT INTO `authors` VALUES (4, 'Jane Blogg');
Stories Table
# phpMyAdmin SQL Dump
# version 2.5.7-pl1
# http://www.phpmyadmin.net
#
# Host: localhost
# Generation Time: Jun 28, 2008 at 02:07 PM
# Server version: 5.0.51
# PHP Version: 5.2.6
#
# Database : `cms`
#
# --------------------------------------------------------
#
# Table structure for table `stories`
#
CREATE TABLE `stories` (
`sid` int(4) NOT NULL auto_increment,
`title` varchar(20) NOT NULL default '',
`author` int(4) default NULL,
`story` text NOT NULL,
`s_date` date NOT NULL default '0000-00-00',
PRIMARY KEY (`sid`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
#
# Dumping data for table `stories`
#
INSERT INTO `stories` VALUES (1, 'PEAR: easy as pie!', 4, 'Rapiebant me spectacula theatrica, plena imaginibus miseriarum mearum et fomitibus ignis mei. quis est, quod ibi homo vult dolere luctuosa et tragica, quae tamen pati ipse nollet? et tamen pati vult ex eis!rnrnRapiebant me spectacula theatrica, plena imaginibus miseriarum mearum et fomitibus ignis mei. quis est, quod ibi homo vult dolere luctuosa et tragica, quae tamen pati ipse nollet? et tamen pati vult ex eis!rnrnRapiebant me spectacula theatrica, plena imaginibus miseriarum mearum et fomitibus ignis mei. quis est, quod ibi homo vult dolere luctuosa et tragica, quae tamen pati ipse nollet? et tamen pati vult ex eis!rn', '2008-06-25');
INSERT INTO `stories` VALUES (2, 'Connecting with PEAR', 3, 'Rapiebant me spectacula theatrica, plena imaginibus miseriarum mearum et fomitibus ignis mei. quis est, quod ibi homo vult dolere luctuosa et tragica, quae tamen pati ipse nollet? et tamen pati vult ex eis!', '2008-06-25');
INSERT INTO `stories` VALUES (3, 'The great connection', 2, 'Rapiebant me spectacula theatrica, plena imaginibus miseriarum mearum et fomitibus ignis mei. quis est, quod ibi homo vult dolere luctuosa et tragica, quae tamen pati ipse nollet? et tamen pati vult ex eis!', '2008-06-25');
Users Table
# phpMyAdmin SQL Dump
# version 2.5.7-pl1
# http://www.phpmyadmin.net
#
# Host: localhost
# Generation Time: Jun 28, 2008 at 02:07 PM
# Server version: 5.0.51
# PHP Version: 5.2.6
#
# Database : `cms`
#
# --------------------------------------------------------
#
# Table structure for table `users`
#
CREATE TABLE `users` (
`uid` int(4) NOT NULL auto_increment,
`uname` char(8) NOT NULL,
`upass` char(8) NOT NULL,
`level` varchar(8) NOT NULL,
PRIMARY KEY (`uid`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
#
# Dumping data for table `users`
#
INSERT INTO `users` VALUES (1, 'david', 'pass', 'admin');
INSERT INTO `users` VALUES (2, 'John', 'pass', 'normal');
Simply copy and paste this information into your database client and run the code. The tables will be created for you. Also, because security is not what we are focusing on at this point, I've not taken precautions as regards to password encryption and the like. You will need to take this into consideration if you want to use this application seriously.
Next: The PEAR::DB connection >>
More PEAR Articles Articles
More By David Web