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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:25:18+00:00 2026-06-14T00:25:18+00:00

function get_total_urls(){ $total = mysql_query(SELECT COUNT(‘url_key’ FROM ‘urls’)); $url_total = mysql_result($total, 0); echo $url_total;

  • 0
 function get_total_urls(){
    $total = mysql_query("SELECT COUNT('url_key' FROM 'urls')");

    $url_total = mysql_result($total, 0);
    echo $url_total;
  }

returns error:

Warning: mysql_num_rows() expects parameter 1 to be resource

I have been browsing to find the cause, most people get it due to the lack of mysql_query but I’m using that.

Any ideas where I’m going wrong? I know the database information is correct.

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-14T00:25:20+00:00Added an answer on June 14, 2026 at 12:25 am

    Your query is failing. Therefore, $total is receiving false instead of the MySQL resource. Hence the error.

    This is because you are using single quotes instead of back ticks (or nothing) and an incorrect syntax for COUNT().

    SELECT COUNT(`url_key`) FROM `urls`;
    

    Note: When in doubt, run your query directly against MySQL (from CLI or PHPMyAdmin) or use mysql_error().

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

Sidebar

Related Questions

function get_total_adults() { $sql = SELECT SUM(number_adults_attending) as number_of_adults FROM is_nfo_rsvp; $result = mysql_query($sql)
I use SQL COUNT function to get the total number or rows from a
$count = 5; function get_count() { static $count = 0; return $count++; } echo
I have a class, with a function which returns a count, like this: class
function get_arr($arr) { unset($arr[0]); } $arr1 = array(1,2); $arr2 = array(1,2); get_arr(&$arr1); get_arr($arr2); echo
I've a php function to get some data from mysql database: function get_persons() {
I want to ask how to get total amount if we use substring function,
I have the following function in my c# silverlight application to find the total
I have a function that gets the number of unpublished records from a table
I try to make function to check if table exists and to get total

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.