DesignPatternStep1

From mi-linux
Revision as of 15:53, 12 July 2011 by In9352 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Main Page >> Advanced Web Technologies >> Workbook >> Week 04 >> Step 1 - Create and populate database

Step 1 - Create and populate database

First, let’s create a very simple table to store our blog messages.

The following SQL code will create the table and populate it with a couple of dummy records. Simply paste it and run it in phpmyadmin.

CREATE TABLE IF NOT EXISTS `messages` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `date_added` datetime NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=19 ;

INSERT INTO `messages` (`id`, `title`, `message`, `date_added`) VALUES
(1, 'Test 1', 'Hello world!', '2009-07-27 15:06:29'),
(2, 'Test 2', 'Hiya', '2009-07-27 15:06:38');

This is what you should be seeing on your screen:

6cc001-patterns-mysql1.gif

>> Onto Step 2