Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    57

    Unanswered: Displaying the number of registered users...

    Hi there!

    I want to permanently display on a page the number of registered users of my site (not the visitors which is something different...)

    Would you please tell me how to write the query which could return for my table 'users' the greatest existing value of the column 'userID' with a permanent updating of the value, say, every hour?

    Many thanks in advance for your help.

  2. #2
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    The query would be as simple as this.
    $query="select count(*) as cnt from users";
    $result=mysql_query($result);
    $row=mysql_fetch_array($result);
    $reg_cnt=$row['cnt']; //this would be the no of registered users in your table users.

    hope this would be your solution.. If not get back to us..

    Regards
    Rajesh

  3. #3
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    57
    Hi Rajesh!

    Once again, I found your help!
    Thank you very much.

    Here is the script I use which is fully functional thanks to your help.
    Could you revisit it and, perhaps find a more simple way to write the last part, the one which sends the result back to my Flash file...?

    Best regards,

    Gerard

    Code:
    <?php  
    include 'key.php' ; 
    $table ="users" ; 
    mysql_connect ($host ,$user ,$pass ) or die( "cannot connect " .mysql_error () );  
    mysql_select_db ($db ) or die( "cannot select db " .mysql_error () );  
    $result =mysql_query ("SELECT COUNT(*) AS userID FROM $table " ) or die ( "select error " .mysql_error () );  
    $index=$field; 
    if ( mysql_num_rows($result ) > 0) { 
    while ( $row =mysql_fetch_row($result ) ) { 
    foreach($row as $field) { 
    print "status=ok</br>&totalUtilisateurs=" .$field;  
    } 
    }  
    } 
    else  
    print "status=name not found" ; 
    ?>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •