Trying to ad a online table, what should it be set to?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Breana
    New Member
    • Aug 2007
    • 117

    #16
    Ok like this:
    [PHP]<?
    $sql = "SELECT COUNT(`uid`) FROM `users` WHERE `last_active` > TIMESTAMP(NOW() , '00:15:00')
    GROUP BY `uid`";
    $result = mysql_query($sq l ,$db);?>[/PHP]

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #17
      Heya, Breana.

      That looks pretty good. Then just call mysql_fetch_row ($result), and echo index 0 of the resulting array.

      Comment

      • Breana
        New Member
        • Aug 2007
        • 117

        #18
        Ok i have it like this:
        [PHP]Total online: <?
        $sql = "SELECT COUNT(`uid`) FROM `users` WHERE `last_active` > TIMESTAMP(NOW() , '00:15:00')
        GROUP BY `uid`";
        $result = mysql_query($sq l ,$db);
        mysql_fetch_row ($result);?>[/PHP]

        "echo index 0" what....
        you mean i need to echo ("index 0"); or what?

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #19
          Heya, Breana.

          This line:
          [code=php]
          mysql_fetch_row ($result);
          [/code]

          Returns an array. You'll want to assign that array to a variable and then echo its 0th index.

          I.e.,[code=php]
          $row = mysql_fetch_row ($result);
          echo $row[0];
          [/code]

          Comment

          • Breana
            New Member
            • Aug 2007
            • 117

            #20
            Ok now it works sort of, it don't show 1 or 5 but this 209.33.95.33?
            What is that... my ip address. (0 ^ 0)

            Do i need to change the (0) to uid? so it shows a number

            Comment

            • Breana
              New Member
              • Aug 2007
              • 117

              #21
              I just tried again i cant seem to get the number to pop not the ip or what ever that is...

              Comment

              • Breana
                New Member
                • Aug 2007
                • 117

                #22
                Anyone got an idea on how to fix this?

                Comment

                Working...