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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:08:22+00:00 2026-06-01T16:08:22+00:00

I am developing my own forums and everything is working perfectly apart from when

  • 0

I am developing my own forums and everything is working perfectly apart from when I attempt to ORDER BY date_time. My table name is correct and so is all the field names! A PHP error is given when I add ORDER BY date_time to the query and I can’t understand why, as it works perfectly fine elsewhere on the site. The code and error are below:

// query responses
$sqlresponses = mysql_query("SELECT * FROM forum_replb ORDER BY date_time WHERE post_id='$disc_id'");
$responseList = "";
$numRows = mysql_num_rows($sqlresponses);
if ($numRows < 1) {
    $responseList = "There are currently no responses to this discussion/post yet! Add one above.";
} else {
    while($row = mysql_fetch_array($sqlresponses)){
        $response_author_id = $row["author_id"];
        $reply_body = $row["reply_body"];
        $date_time = $row["date_time"];
            $date_time = strftime("%b %d, %Y", strtotime($date_time));
        $responseList .= '<div id="sub_response_module"><p>' . $reply_body . ' -
        <a href="../profile.php?id=' . $response_author_id . '">' . $response_author_id . '</a> 
        | <i>' . $date_time . '</i></p></div>';
    }
}

Error:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/public_html/lb/forum/post.php on line 49

Just to clarify, line 49 is $numRows = mysql_num_rows($sqlresponses);.

  • 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-01T16:08:24+00:00Added an answer on June 1, 2026 at 4:08 pm

    Your ORDER BY clause needs to be after the WHERE clause:

    SELECT * FROM forum_replb WHERE post_id='$disc_id' ORDER BY date_time
    

    Please also note that the mysql_ family of functions are deprecated. You should use the mysqli_ functions, or possibly better still PDO.

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

Sidebar

Related Questions

I'm working on developing my own programming language, and to generate executables I wished
I'm developing a facebook app with rails that uses external apis from my own
People have been developing own solutions to the following problems: Consistent messaging frameworks for
I'm developing own CMS and i want to implement functionality to dynamically include existing
When developing my own Java class to use within ColdFusion 8 I stumble upon
I'm developing my own FTP Client in C#, and - what's curious - sometimes
I'm developing my own OS, but for this I need to touch on linking,
I'm thinking about developing my own PHP based gallery for storing lots of pictures,
I have just started with wordpress and want to start developing my own themes.
I am new to UserControls, and while developing my own control I found a

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.