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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:03:44+00:00 2026-05-27T12:03:44+00:00

Hello I’m trying to query my database table shout_out, during the while loop I

  • 0

Hello I’m trying to query my database table “shout_out”, during the while loop I have an if statement to check to if the “convers_id” column has been change from no_reply. if it has I want another query to run and get all the rows from shout_out_reply table that have the same “convers_id” column. I’m trying to get a similar lay out as a facebook “wall”. Some one make a comment and others can reply to that comment with the reply being under the original comment.

I keep getting that the mysqli_query($dbc, $query_shout_out_reply) has failed. but there are reply’s with the same “convers_id”

$query_shout_out = "SELECT * FROM shout_out WHERE sent_to = '$username' ";
$shout_out_query = mysqli_query($dbc, $query_shout_out);

if (mysqli_num_rows($shout_out_query) != 0) {
    while ($row = mysqli_fetch_array($shout_out_query)) {
        echo '<td class="shout_out_display" width="550">';
        echo $row['message'] . ' <br/><br/> From ' . $row['sent_by'] . ' at ' . $row['date_sent'];
        echo '</td></tr>';
        echo $row['convers_id'];
        if ($row['convers_id'] != "no_reply") {
            $query_shout_out_reply = "SELECT * FROM shout_out_reply WHERE convers_id = " . $row['convers_id'];
            $shout_out_reply_query = mysqli_query($dbc, $query_shout_out_reply);

            while ($reply_row = mysqli_fetch_array($shout_out_reply_query)) {
                echo ' <tr width="550"><td width="125" > &nbsp </td>';
                echo '<td width="425"  class="shout_out_reply_display">';
                echo $reply_row['message'] . '<br/><br/>Reply From ' . $reply_row['sent_by'] . ' at ' . $reply_row['date_sent'];
                echo '</td></tr>';
            }
        }

    }
}
  • 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-27T12:03:44+00:00Added an answer on May 27, 2026 at 12:03 pm
    SELECT * FROM shout_out AS so LEFT JOIN shout_out_reply AS sor ON sor.convers_id = so.convers_id WHERE so.sent_to = '$username' AND so.convers_id != 'no_reply'
    

    The key here is to use an SQL JOIN statement. It’ll give you the results from both tables in one statement. …then you don’t have to go through the loop. making all those sql requests.

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

Sidebar

Related Questions

Hello guys i have an website online wich access the database. The database access
Hello guys I am working on silverlight and I have issue regarding on database
Hello I have this query... if (isset($_REQUEST['deletePost'])) { $q = $dbc -> prepare(DELETE FROM
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
Hello we have an SQL server application running over a low bandwith connection. We
Hello I wrote an application and while deploying shows error in line mCamera=Camera.open(); Where
Hello everyone i am trying to format the input number range with php number_format
hello friends i am trying to get a list of user id and want
Hello Guys I am trying to figure out why i am gettings this error
Hello i have a TextField on my scene. It haves only digits, user input

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.