Jump to content

christianmiles40

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by christianmiles40

  1. 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"; } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.