hi, I decided to build a quick forum system for my site. nothing too advanced...heres the db setup i have.

create table ForumsTopics
(
id int auto_increment not null,
topic_id varchar(7) not null,
title char(100) not null,
cat char(1) not null,
views char(6) not null,
date DATETIME not null,
last_mod TIMESTAMP not null,
PRIMARY KEY (id)
);


create table ForumsThreads
(
id int auto_increment not null,
username varchar(16) not null,
topic_id varchar(16) not null,
message varchar(7500) not null,
created DATETIME not null,
last_modified TIMESTAMP not null,
PRIMARY KEY (id)
);

I realized I don't need two seperate tables, ForumTopics & ForumThreads.

By setting it up in two tables, I will have to select from two tables to retrieve the topic title and message when displaying the message page. But when viewing the forum topics page, I will need to select from one table.

I want to design this so its as efficient as possible, and memory storage is not a problem. Meaning, I want a database setup that will sacrafice space rather then processesing speed.

Now if I decide to make just one table to include the topic , category , message body , etc. then all my SELECTS will only need to select from ONE table. But if this application was built to serve thousands viewing at the same time, then would having two tables help efficiency since it will reduce the loads?


Thanks for taking your time to read this.

Cheers,
Bobby

hi there,

i m also learning php and mysql at the moment at a very slow but lively pace. i am using this book. very good one :

PHP and MySQL Web Development
by Luke Welling, Laura Thomson

http://www.amazon.com/MySQL-Web-Development-Luke-Welling/dp/0672317842

OR

http://www.samspublishing.com/bookstore/product.asp?isbn=067232525X&rl=1#info3

if you go to the above link (sams site), there is a zip file that has all the code of the book which can help you learn and the most important thing is there is a chapter dedicated to building an online forum using php+mysql.

Chapter 29. Building Web Forums

hope this helps,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.