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 8302823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:22:50+00:00 2026-06-08T17:22:50+00:00

I have questions which I’m reading form database and with while loop I show

  • 0

I have questions which I’m reading form database and with while loop I show them all, but now I have answers on that questions also in database just in the other table.
So, I need to put those answers into textarea’s below every question, for questions without answers just to leave empty textarea.
How can I know in the loop where to put specific answer, I mean how to tide questions-answers?
Thanks.

here is the loop:

$j = 1;
    while($rowQuestion = $connector->fetchArray($resultUser)) {

        echo "
            <div class='question'>
                <h4>".$rowQuestion['wq_title']."</h4>
                <p>".$rowQuestion['wq_desc']."</p>
        ";
            $queryAnswer = "SELECT *
            FROM workshop_answers
            WHERE id_user='".$_GET['userid']."' AND q_comp='1' AND id_que='".$j."'";
            $resultAnswer = $connector->query($queryAnswer);
            $rowAnswer = $connector->fetchArray($resultAnswer);

        echo "
            <textarea readonly='readonly' id='".$j."'>".$rowAnswer['q_answer']."</textarea>

            <div class='ftr'>
                <a href='#top' class='pull-right'>Back to Top</a>
            </div>
            </div>
        ";
        $j++;
    }

Hey guys I made some modifications and now it works great. 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-06-08T17:22:52+00:00Added an answer on June 8, 2026 at 5:22 pm

    Use left outer join in your sql query to join the question table and answer table.

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

Sidebar

Related Questions

Well, sad to say, but I have 2 questions, which I wish I could've
basically i have a database, which contains a random amount of questions i have
I have seen similar questions which attempt to solve this issue, but none seem
I'm looking to implement my first Android database, but I have so many questions
I've been reading around SO and have come across the following questions which touch
I have questions which are represented like this in my SQL database : CREATE
I've asked a few questions which have touched around this issue, but I've been
All, I'm allowing my user to create questions which I'll need to save answers
I have 3 tables: questions answers qa_assoc which standing for question id<->answer id relationship
Now, I have read these questions which may have a relation with this question:

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.