We need our website to be interactive and most interactive websites require a database.
We are working with codeigniter and php so our database will obviously be on MYSQL (hope you know SQL).
Lets create a database and call it 'shoutbox', obviously without ' ' .
Now create a table called 'shouts' with 4 fields for now,
- The first field will be 'id', which will be a int with value 11 and have 'PRIMARY KEY' and 'AUTO INCREMENT' on.This is used for counting and arranging the shouts/comments/chats.
- Second field will be 'name' with type 'varchar' and value 255.This is used to store the name of the person making a comment/shouting/chatting.
- Third- 'shout' with type 'text'.This is where the comments/shouts/chats are stored
- Forth- 'email' with type ' varchar' and value 255.Obviously to store the email.
You can create this table manually using phpmyadmin or using phpmysql sql option insert this code(copy paste the code below in red) and things will be auto created for you.
-- phpMyAdmin SQL Dump
-- version 3.2.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 29, 2010 at 09:43 AM
-- Server version: 5.0.90
-- PHP Version: 5.2.6
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: zbyte_shoutbox`
--
-- --------------------------------------------------------
--
-- Table structure for table `shouts`
--
CREATE TABLE IF NOT EXISTS `shouts` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`shout` text NOT NULL,
`email` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ;
--
-- Dumping data for table `shouts`
--
INSERT INTO `shouts` (`id`, `name`, `shout`, `email`) VALUES
(1, 'zeeshaan', 'first shout!', 'mail@fungupshup.com'),
(2, 'zeeshout', 'second shout', 'mail@zbyte.org'),
(3, 'greenday', 'Do you know your enemy', 'greenday@gd.com'),
(4, 'site-management', 'test4chk', 'works@gmail.com');
I have inserted some values there.. once you insert this code you will have something like this.

The first name is zeeshaan, Because my name is zeeshaan and the email is @fungupshup.com, cause that's one of my site .Second one is zeeshout, cause my pet name is zee and i shouted! and the email is @zbyte.org cause again that's one of my site. The third one is greenday cause i am a green day fan and the email is @gd.com cause thats the shortform for greenday and gd.com IS NOT MY SITE! just some general knowledge for you people :-D .okay you don't wana kill me for this!
Lets move on ...
Now, the database is ready we can go to step 3 ...
Leave a comment for help !
No comments:
Post a Comment