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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:14:06+00:00 2026-06-01T19:14:06+00:00

I am encountering an error. My log is as follows: PHP Warning: mysql_num_rows(): supplied

  • 0

I am encountering an error. My log is as follows:

PHP Warning:  mysql_num_rows(): supplied argument is not 
a valid MySQL result resource in     
/home/domain/public_html/index.php on line 96

My code is as followsL
line 96:

mysql_num_rows(mysql_query("SELECT * FROM `table` WHERE 
UNIX_TIMESTAMP(`date`)>$user_last_visit"));

What could cause this error?

  • 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-01T19:14:07+00:00Added an answer on June 1, 2026 at 7:14 pm

    You put two functions into each other directly:

    mysql_num_rows(mysql_query(...));
    

    Technically this is possible to do (function 1 returns something that becomes the parameter of function 2), however, in case function 1 returns something that function 2 can not deal with, you get errors.

    That happens in your case. Instead store the return value into a variable and do error handling your own:

    $result = mysql_query(...);
    if (!$result) {
        throw new Exception(sprintf('Database query failed: %s', mysql_error()));
    }
    $num_rows = mysql_num_rows($result);
    

    Proper error handling is crucial for solid programming, so take care about return values. When in doubt double-check for the function in question with the PHP manual which is really a great resource. See mysql_query.

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

Sidebar

Related Questions

I am encountering the C2783 error with Visual C++ (could not deduce template argument),
I'm trying to add some error checking inside my PHP script. Is it valid
I am encountering this error when I am loading an Ad Hoc build of
I am encountering an error when I am trying to deploy my DB project.
I'm encountering an error I can't seem to figure out in my bare-bones program
I seem to be encountering an error when reading from a text file. This
I've been doing some simple shaders and Im encountering an error that happens randomly,
I am encountering the following error in my app. upon starting it: [3/26/12 13:05:26:109
I'm encountering this error : Membership credential verification failed. when I try to login
I'm trying to create a payment calculator, however I am encountering an error in

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.