[INFO]Total users registred -> sql
#1

how to calculate the total users registred, into the database ? i use BlueG MySQL Plugin
Reply
#2

SELECT NULL FROM <userdb>

new tRows = mysql_num_rows();

tRows = How many users are in the <userdb>.
Reply
#3

pawn Код:
mysql_query("SELECT * FROM users");
new total_registered_users = mysql_num_rows();

edit: too late.
Reply
#4

Thanks
Reply
#5

exactly is this, correct ?

PHP код:
    format(querysizeof(query), "SELECT * FROM `%s`"TABLE_NAME);
    
mysql_query(query);
    
    
mysql_store_result();
    
    new
        
total_users mysql_num_rows();

    
mysql_free_result();

    print(
"-----------------------------------------------------------------------------");
    
printf("MySQL: The are %d users registred"total_users);
    print(
"-----------------------------------------------------------------------------\n"); 
Reply
#6

bump
Reply
#7

Why would you select everything? A waste of memory.

pawn Код:
format(query, sizeof(query), "SELECT COUNT(*) FROM `%s`", TABLE_NAME);
    mysql_query(query);
   
    mysql_store_result();
   
    new
        total_users = mysql_fetch_int();

    mysql_free_result();
Or whatever function gets the integer from the field.
Reply
#8

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
Why would you select everything? A waste of memory.

pawn Код:
format(query, sizeof(query), "SELECT COUNT(*) FROM `%s`", TABLE_NAME);
    mysql_query(query);
   
    mysql_store_result();
   
    new
        total_users = mysql_fetch_int();

    mysql_free_result();
Or whatever function gets the integer from the field.
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)