Structure of phpBB?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
RFairey
Forum Commoner
Posts: 52
Joined: Fri Jun 06, 2003 5:23 pm

Structure of phpBB?

Post by RFairey »

What is the structure of the Database behind phpBB? When it is running on MySQL that is. Just a rough outline of what sort of fields are necessary, how the threads are stored, what datatypes they might be etc.

I am thinking of writing a messageboard that is small and very simple, without any frills that phpBB might have - I just need to know roughly where to start in terms of database design.
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

I've never installed it so I couldn't tell you but it is a free program. Just go to http://phpbb.com/downloads.php and download it to check out some of the files.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

The easiest way to do it is to write down everything to might need to store in the database and then devide your list into groups of 'related' info.

--------------

For example when I create simple forums I will use some tables like this..

forum_registration ( id, username, password, emailaddress, status )

forum_profile ( username, fullname, age, dob, location, gender..... etc )

forum_membersetup ( username, topicsperpage, repliesperpage, gmtoffset... etc )

forum_topics ( id, title, blurb, date, postedby, status, views )

forum_replies ( id, parent, blurb, date, postedby, status )

--------------

Hope this helps?
RFairey
Forum Commoner
Posts: 52
Joined: Fri Jun 06, 2003 5:23 pm

Post by RFairey »

Would I need a new table for each thread / post, or would I store all posts in one table, linked somehow to their parent thread, with the threads linked to a parent board?
Which method is best for fast searching/fast retrieval?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Yep, keep all of your topics in one table, and all of your replies in another.

I normally have the 'reply parent' as the 'topic id' which the reply is for.

I also add a timestamp to the end of the topics and replies so that I can display them in the right (or chosen) order.

You can also use the topic and/or reply timestamps, along with cookies to check if any new topics/replies have been added while the user was away... like phpBB.
RFairey
Forum Commoner
Posts: 52
Joined: Fri Jun 06, 2003 5:23 pm

Post by RFairey »

So something like (at minimum):


Boards (ID, Name, List of thread IDs)

Threads (ID, Title, List of Post IDs)

Posts (User, Timestamp, IP, Message Data)

Would be a way of going about it? How would I implement the lists in a database? Is there a MySQL datatype for arrays of sorts, and is it extendable (ie doesn't need to be DIMed)?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

I can't write your entire database layout for you mate... it's not difficult really... just think about what data is going to need to be pulled from, and entered, into the database.

Sorting out your datatbase is the easy bit, coding your forum is harder, so if you are having trouble working out which tables to use and what fields should be in the tables then this isn't going to be an easy job for you.

I take it you know how to read/write data to a MySQL database using PHP?
RFairey
Forum Commoner
Posts: 52
Joined: Fri Jun 06, 2003 5:23 pm

Post by RFairey »

Yessss.......

Sorry if I'm asking too many questions - you don't HAVE to read this you know!

Just wondering if there are any pitfalls with any particular methods people have tried before - ah well, I suppose I'll just jump in and find out myself, thanks for your help so far.
Post Reply