Files used - Create_Forum.php , forum_post.html
Description : forum_html is used as a seperate template file , this is a simple way to echo a forum post. You will also need to create a database with an ID , TITLE , and TEXT field . Hope this helps!!!
Code for : Create_forum.php
<?php
function CreateForum($id){
//Mysql information
define(HOST,"enter hostname");
define(USER,"enter username");
define(PASS,"enter password ");
define(DATABASE,"enter database");
//Connect to database
$con = mysql_connect(HOST,USER,PASS);
mysql_select_db(DATABASE);
//Include forum_post.html
$dir = "forum_post.html";
include($dir);
//Sql statement used to find a topic based on an id number
$sql = "SELECT * FROM database WHERE $id = topic";
//Execute query
$query = mysql_query($sql);
//Check for a successful query ELSE return error message
if($query){
//Loop through database if successful query
while($row = mysql_query($sql)){
$title = $row->title;
$text = $row->text;
//echo forum
echo "
<div>
<h1>".$title."</h1>";
echo "
<p>".$text."</p>
</div>";
}
}else{
echo "Mysql Error";
}
}
?>