2 Replies - 576 Views - Last Post: 28 January 2013 - 02:55 PM Rate Topic: -----

#1 Youmay  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 28-January 13

Total users.

Posted 28 January 2013 - 06:46 AM

Hi friends i will trying to my website show total registered users but script was not working so i want help here is the script -
<?php session_start(); include_once 'config.php'; 
$number = my_query(mysql_query=("SELECT COUNT (uid) AS number FROM `users`"));
$row = mysql_fetch_array($number);
echo "There are total $row['uid'] registered users. 
{
?>
<?
}
?>

any one tell me what wrong in this script.

Its showing an error like this -
syntax, error, T_string Variable
a*******/public_html/index.php

Is This A Good Question/Topic? 0
  • +

Replies To: Total users.

#2 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3729
  • View blog
  • Posts: 13,019
  • Joined: 12-December 12

Re: Total users.

Posted 28 January 2013 - 07:02 AM

You haven't told us what line number causes the error, and what line this refers to in your posted code.

However,

echo "There are total $row['uid'] registered users.

you haven't completed this line. The lines that follow this one are also odd.

BTW I would also back-tick a field name like `number`.
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3569
  • View blog
  • Posts: 10,402
  • Joined: 08-June 10

Re: Total users.

Posted 28 January 2013 - 02:55 PM

SELECT COUNT (uid) AS number FROM `users`

in this SQL code the count comes up under the "number" index, since you named it that way.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1