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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:48:47+00:00 2026-05-26T00:48:47+00:00

SELECT listTitle, listLength, listCmt, listDt, mBCFName, mBCLName, moAmt, moDtOff FROM User U, Listing L,

  • 0
SELECT listTitle, listLength, listCmt, listDt, mBCFName, mBCLName, moAmt, moDtOff
FROM User U, Listing L, Merchant M, MerchantOffer MO
WHERE U.uID = L.uID
and L.listID = MO.listID
and M.mID = MO.mId
ORDER BY listDt DESC;

This foreach() loop

    $result = $sth->fetchAll(PDO::FETCH_ASSOC);
    foreach($result as $row) 
    { 
    echo "<div class='listing'>";
        print '<br>Title: ' . $row['listTitle'] . '<br>Comment: ' . $row['listCmt'] . 
        '<br>Date: ' . $row['listDt'] . '<br>Offer By: ' . $row['mBCFName']. ' ' .$row['mBCLName']. '<br> for: ' . $row['moAmt'];
    echo "</div>";
    }   

produces:

enter image description here

Basically what I want is:

Title: Apple iPhone 4S (listTitle)
Days: <some day amount <listLength>
Comment: some comment <listCmt>

    Offer By: some user <mBCFName mBCLName>
    Offer:  19.99 <moAmt>
    Date: 10/03/2011 < moDtOff>

    Offer By: some user <mBCFName mBCLName>
    Offer:  19.99 <moAmt>
    Date: 10/03/2011 < moDtOff>

    Offer By: some user <mBCFName mBCLName>
    Offer:  19.99 <moAmt>
    Date: 10/03/2011 < moDtOff>

    Offer By: some user <mBCFName mBCLName>
    Offer:  19.99 <moAmt>
    Date: 10/03/2011 < moDtOff>
  • 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-26T00:48:48+00:00Added an answer on May 26, 2026 at 12:48 am

    It sounds to me like you want to print listTitle as a group heading above the relevant comments.

    One way to do it would be to keep track of listTitle of the previous row, and then only print it if there’s a difference with the current row. Of course, you’d have to make sure your result set is ordered by listTitle.

    Another way would be to have one query that gets all data for that group heading, then another query that gets the contents of the group.

    It is also probably possible to do it in the query, but that will be tricky since you want the first record with that listTitle to have a value for listTitle and the others to have null – until the next listTitle that’s different.

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

Sidebar

Related Questions

UPDATED SQL: SELECT listTitle, listLength, listCmt, listDt,GROUP_CONCAT('',mBCFName,' ',mBCLName,' ',moAmt,'<BR>') AS mOfferInfo FROM User U
SQL: SELECT uFName, uLName, listTitle, listPropPrice, listCmt, listDt, mFName, mLName, moAmt, moDtOff FROM User
SELECT id,name,SUM(`lsa`) AS lst FROM table_a AS sn, table_b AS fb WHERE sn.uid=fb.uid AND
SELECT COUNT(*) FROM song AS s JOIN user AS u ON(u.user_id = s.user_id) WHERE
SELECT events.title FROM events ORDER BY events.title DESC I'm getting the proper ordering for
SELECT sum(TotalHoursM) + (TotalHoursT) + (TotalHoursW) + (TotalHoursTH) + (TotalHoursF) AS TOTAL FROM LeaveRequest
SELECT (SELECT IIF(IsNull(sum(b.AmountCharged) - sum(b.AmountPaid)), a.Balance, (sum(b.AmountCharged) - sum(b.AmountPaid))) FROM tblCurrentTransaction AS b WHERE
SELECT AVG(variable) AS Expr1, SUM(variable) AS Expr2 FROM ...... result for AVG is 2,
SELECT * FROM menu WHERE item_id = 1 OR item_id = 2 OR item_id
SELECT * FROM myTable WHERE field1 LIKE 'match0' AND myfunc(t1.hardwareConfig) LIKE 'match1' Here is

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.