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

  • SEARCH
  • Home
  • 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

I am willing to create a simple desktop application for myself which will be
While I'm perfectly willing to believe that this has been asked elsewhere, I haven't
I want to create simple custom control (derived from control and with look defined
I'm trying to create a persistent SQL (SQL Server 2005) lock on a table
I am attempting to create the following scenario, and I'm willing to use any
I'm willing to create a little frame to display animated ads in my app.
I'm trying to create a mysql table from a thesaurus text file I got
My goal here is to create a very simple template language. At the moment,
I'm planning to use Python Bottle framework for a simple website. Except for the
I am willing to create div's dynamically on double clicking anywhere on the page.

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.