Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1069729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:27:47+00:00 2026-05-16T20:27:47+00:00

Ok, I am willing to create a simple forum for my website. So, let’s

  • 0

Ok, I am willing to create a simple forum for my website. So, let’s begin.

I guess thread table is going to be smth like this:

t_id, thread_name, who_created, when_created

And replies table is going to be smth like this:

r_id, t_id, who_wrote, what_wrote, when_wrote

And when somebody wants to view thread with replies, he clicks button which moves him to index.php?t_id=1 or smth like that. t_id means threads’ table value t_id. What join query should I write for showing topic and its replies?

mysql_query('SELECT *
             FROM threads AS t
             INNER JOIN replies AS r
             ON t.t_id = r.t_id
             WHERE t.t_id = '.mysql_escape_strings($_GET['t_id']));

Is it right? Then how should I pull out all that data? With mysql_fetch_array? Then how? Any suggestions? Maybe better write 2 queries instead of JOIN? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:27:48+00:00Added an answer on May 16, 2026 at 8:27 pm

    Don’t use a join in this case as it does not give any advantage and instead it will slow down the queries. Rather do two separate queries:

    mysql_query('SELECT *
             FROM threads AS t
             WHERE t.t_id = '.mysql_escape_strings($_GET['t_id']));
    

    And:

    mysql_query('SELECT *
             FROM replies AS r
             WHERE r.t_id = '.mysql_escape_strings($_GET['t_id']));
    

    This will be much faster.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a minor bug (one I'm willing to live with in the interest
I want to create simple custom control (derived from control and with look defined
My goal here is to create a very simple template language. At the moment,
I have a directory structure in svn like this: Project A branches tags trunk
I recently asked about keyword expansion in Git and I'm willing to accept the
Does anyone have recommendations/experience of how to find people willing to do usability testing
Is there a good library for extracting text from a PDF? I'm willing to
I'v never done unit testing before, but now I am willing to give it
I'm trying to create a messagebox that is fixed to the bottom of a
I have search throughout this site to find a answer to my problem and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.