-4

In my app I have login/registration system and need to count the total number of registered users. For example I have 2 registered users.

----------------------------------------------------
|id|    email      |use_name|user_pass|confirm_pass|
----------------------------------------------------
|7 | theo@gmail.com|  theo  | my pass |   my pass  |
----------------------------------------------------
|8 | test@gmail.com|  test  | my pass |   my pass  |
----------------------------------------------------

The is a function in mysql called SUM,but it adds ints.In my case though the id is incrementing from the last deleted user.

Thanks,

Theo.

Theo
  • 3,099
  • 12
  • 53
  • 94

1 Answers1

-1

use mysql_num_rows on your query.

http://php.net/manual/en/function.mysql-num-rows.php

Considering moveing away from mysql to mysqli or PDO if you are a new. Instead of learning an outdated and no more supported mysql.

Darloz
  • 165
  • 11
  • 2
    Highly inefficient to select using 'where 1=1' and use mysql_num_rows just to count, Sougata`s solution to use an aggregate function COUNT() is faster – ka_lin Jul 08 '16 at 07:55