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

The Archive Base Latest Questions

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

$sql = select count(userId) from tblUser; $result=mysql_query($sql,$link)or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_NUM); echo $row[1];

  • 0
$sql = "select count(userId) from tblUser";
$result=mysql_query($sql,$link)or die(mysql_error());
$row = mysql_fetch_array($result, MYSQL_NUM); 
echo $row[1];   

print_r($row); is displaying no of records but whu echo is not working

  • 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-15T02:26:47+00:00Added an answer on May 15, 2026 at 2:26 am

    You need mysql_num_rows

    echo mysql_num_rows($result);
    

    That’ll give you number of rows return from query.


    If, however, you are using the count keyword in your query, you should modify your code like this:

    $sql = "select count(userId) as total from tblUser";
    $result = mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_assoc($result);
    echo $row['total'];
    

    Update:
    You can also count total users like this:

    $sql = "select userId from tblUser";
    $result = mysql_query($sql) or die(mysql_error());
    echo mysql_num_rows($result);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SQL : SELECT COUNT(usr.id) as `total_results` FROM users as usr LEFT JOIN profile as
So I have the following group by SQL select count(*) as NO_OF_MSGS,FROM_USER,PROFILE_IMG,MSG from MESSAGES
I have an sql query like this: SELECT IF( (SELECT COUNT(*) FROM `test_table2` WHERE
$count_sql = preg_replace(/SELECT(.+?)FROM/, SELECT COUNT(*) FROM, $sql); It's probably pretty obvious what I'm trying
SQL server 2008 on WINDOWS 2008 Please compare following sqls: 1. select count(*) from
TOPIC_COUNT_SQL = SELECT COUNT(*) FROM topics_topic WHERE topics_topic.object_id = maps_map.id AND topics_topic.content_type_id = %s
public static int AwaitingApprovals() { int numApprovals = 0; string sql = SELECT COUNT(Type)
i have a sql query where i count the number of rows SELECT count(*)
I am trying to convert the following SQL into a LINQ expression SELECT COUNT(ID)
I have this SQL code here.. SELECT cl.clientid, cl.clientname, cl.billingdate, cp.startdate, cp.expiration, (SELECT COUNT(*)

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.