October 20, 2012 4:45 pm

Create a Simple Forum in PHP

Now days people trying to get forums and searching on net free open source forum etc. Today i am going to make a simple script of forum for all of you and its very simple you can easily implement it on your system.

 

 

 

 

 

Overview

Create bellow 5 files

  1. new_topic.php
  2. add_new_topic.php
  3. main_forum.php
  4. view_topic.php
  5. add_answer.php

Steps

Follow these steps

Create table name “fquestions” and “fanswer” in database “myforum”.
Create file new_topic.php.
Create file add_new_topic. php.
Create file main_forum.php
Create file view_topic.php
Create file add_answer.php

Step 1: Database:

Create database “myforum” and make 2 tables “fquestions” and “fanswer”

Step 2: Create file new_topic.php

Step 3: Create file add_new_topic.php

 Step 4: Create file main_forum.php

 Step 5: Create file view_topic.php

 Step 6: Create file add_answer.php

Author Huzoor Bux

I am Huzoor Bux from Karachi (Pakistan). I have been working as a PHP Developer from last 5+ years, and its my passion to learn new things and implement them as a practice. Basically I am a PHP developer but now days exploring more in HTML5, CSS and jQuery libraries.


Tutorial Categories:
  • minD

    can i use this to my system in company?

    • huzoorbux

      @7d1d19d7df4ebe5a46ea2e785d8e36d9:disqus you can use this code and very soon its new version i am going to publish i hope that will also very helpful for you.

      • minD

        thanks… 😀

  • Patricknet

    nice

  • Miloue

    Is this the same tutorial that is on phpeasystep?

  • Luke Juriga

    This code is great, however, when i go to respond to a topic I can fill the form out, submit it, and it shows that a comment was added, but when I go and look at the topic no response is shown. All I can see is the original post no comment.

  • Carlos A.

    Thanks!!

  • brent

    “; echo “View your topic”; } else { echo “ERROR”; } mysql_close(); ?>

    • michael

      me too

  • if this system has one spam code for validation and write IP in DB, will be very good

  • sss

  • ccc

  • nice conversation

  • fdfffff

  • Kyo Kusanagi

    this forum sux … no threads, no pagination, no security or atleast required fields checkup.
    i expected some effort into this script since you call yourself PHP developer.
    Looks more like a comments section rather than a forum.

    • que

      hello

  • Livaco

    i got this when i try and post somthing “ERROR”

    • Livaco

      I Also Got This On main_forum.php “Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/u404949692/public_html/main_forum.php on line 31”

  • bernard

    wow… this is so outdated… even for a 2012 article … my opinion : Google should review their algoritm by comparing their search results with the php deprecated functions list … lol

  • rk

    kkkklkvmdlksdlk

  • ameer nagvenkar

    cannot add more then one answer to a question

  • ameer nagvenkar

    cannot add more then one answer to a question

    • Megha Kumari

      What did u do then ?even I’m getting same problem

  • Sakhawat Hossain

    I cannot daily attendances php & mysql any body help me & send source code my email : [email protected] Pls …………..

  • Thank you so much Huzoor Bux! I was searching the reply coding for my project as to how to implement and your coding worked! 🙂

  • Adrian Smith

    What should I add for localhost? The web server host name?

  • Tariq Tahiri Bux Mahesar

    thank you sir ; jo apne ye plugin lagai h esa system hum khud nhi bana skte hain ????? reply p reply

  • Aas Hack Exe

    شكر لك

  • Aas Hack Exe

    Upload the image to the database and view it???????????????

  • Vladimir Djukic

    Hi,
    I need help from you. NOW I WATCH YOUR TUTORIAL WITH COMMENTS, I CAN NOT GO TO HOW TO USER EDIT OR DELETE YOUR COMMENT.
    IN FACT THAT THE USER OF LOGIN SHOULD EDIT OR DELETE THE COMMENTER ONLY WHO HAD WAITED AND CAN NOT OTHER COMMENTERS.
    E.G:

    $_SESSION[‘USER’] == ‘USER’;
    $sql = “SELECT * FROM coment WHERE id=’$_SESSION[user]'”;
    $res = mysqli_query($conn,$sql)

    Thanks in advance,
    Greetings ,
    Vladimir