okay here goes 2 explicit tables and 1 implicit table
CREATE TABLE IF NOT EXISTS articles (
ID BIGINT NOT NULL auto_increment,
Title VARCHAR(50) NOT NULL,
Abstract VARCHAR(255) NOT NULL,
Published TIMESTAMP NOT NULL,
Article MEDIUMTEXT NOT NULL,
PRIMARY KEY(ID),
UNIQUE Title (Title),
INDEX Abstract (Abstract),
INDEX Published (Published)
)
CREATE TABLE IF NOT EXISTS replies (
ID BIGINT NOT NULL auto_increment
ArticleId BIGINT NOT NULL,
Title VARCHAR(50) NOT NULL,
Poster BIGINT NOT NULL,
Posted TIMESTAMP NOT NULL,
Msg TEXT NOT NULL,
PRIMARY KEY(ID),
INDEX ArticleId (ArticleId),
INDEX Title (Title),
INDEX Poster (Poster)
)
now a little PHP:
add an article
<?php
function add_article($Title,$Article) {
$Abstract = substr($Article,0,255);
$sql = "INSERT INTO articles (Title,Abstract,Article) VALUES (\"" . $Title . "\",\"" . $Abstract . "\",\"" . $Article . "\")";
@mysql_query($sql);
}
?>
add a replie
<?Php
function add_reply($Title,$Poster,$Article,$Msg) {
$sql = INSERT INTO replies (Title,Poster,ArticleId,Msg) VALUES (\"" . $Title . "\"," . $Poster . "," . $Article . ",\"" . $Msg . "\")";
@mysql_query($sql);
?>
retrieve an article and it's replies
<?php
function retrieve article ($id) {
$sql = "SELECT * FROM articles WHERE ID=$id"
$resullts[0] = @mysql_query($sql);
$sql = "SELECT * FROM replieS WHERE ArticleID=$id";
$results[1] = @mysql_query($sql);
}
?>
hope that helps
WARNING: this code was typed into the message board and has not been tested. If you want spit polished and tested code I charge for that.