Page 1 of 1

Need tips for Forum Database

Posted: Fri May 21, 2004 12:06 pm
by yosuke_
Hi!
How to make a forum? I started to make a forum, I created a tables called forums and topics. The I created everything so far that I can post a post in any forum and it I can view it, but the problem is replys. How can I add reply? do i need to create new table? Please give me some tips how to make forum database!! Thank you!

Posted: Fri May 21, 2004 12:24 pm
by launchcode
Why not just download one of the many free forum packages (PHPBB, XMB, etc etc) and install them and see how they do it? Look at their table structure - it'll go a long way to explaining what you'll need.

Posted: Fri May 21, 2004 12:29 pm
by johnperkins21
I thought about creating my own forum a while ago and downloaded phpBB just to see how they did it. Needless to say, I went ahead and just used phpBB on my site. They have put a lot of time and effort into creating a very good piece of forum software that works very well. If you want to do it just for the learning aspect, do as launchode suggest and look at their structure. They use 29 tables, but 3 of those are just for the polling system.

Re: Need tips for Forum Database

Posted: Fri May 21, 2004 2:17 pm
by d3ad1ysp0rk
yosuke_ wrote:Hi!
How to make a forum? I started to make a forum, I created a tables called forums and topics. The I created everything so far that I can post a post in any forum and it I can view it, but the problem is replys. How can I add reply? do i need to create new table? Please give me some tips how to make forum database!! Thank you!
table "posts":
postid | postmsg | post_user | post_date | topicid

table "topics":
topicid | name | description | poster

Code: Select all

$result = mysql_query("SELECT * FROM posts WHERE topicid = " . $_GET['tid']);
while($row = mysql_fetch_array($result)){
$result2 = mysql_query("SELECT * FROM members WHERE username = " . $row[username]);
$row2 = mysql_fetch_array($result);
echo '<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top" width="80">';
echo "<b>" .$row[username]. "</b><br />";
echo "<b>" .$row2[title]. "</b><br />";
echo "Date: " .$row[date]. "<br />";
echo "</td><td width="*" valign="top">" .$row[postmsg]. "</td></tr></table>";
}
Quickly written, might have errors..

Posted: Fri May 21, 2004 2:44 pm
by yosuke_
Thank you for the reply's!
I wan't to create forum for learning, because I wan't to learn PHP in advinced level. Does phpBB uses MySQL database? Thank you!

Posted: Fri May 21, 2004 2:48 pm
by tim
Database Server Support
phpBB uses a database abstraction layer to enable seamless support of several database servers:


MySQL 3.2x,
PostgreSQL 7.x,
Microsoft SQL Server 7/2000
Microsoft Access (via ODBC)

...with more databases available in the future.