Difference between revisions of "DesignPatternStep1"

From mi-linux
Jump to navigationJump to search
Line 20: Line 20:
 
(2, 'Test 2', 'Hiya', '2009-07-27 15:06:38');
 
(2, 'Test 2', 'Hiya', '2009-07-27 15:06:38');
 
</pre>
 
</pre>
 +
 +
# Onto [[DesignPatternStep2|Step 2]]!

Revision as of 15:47, 12 July 2011

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');
  1. Onto Step 2!