SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    get the average visit per day from hit counter

    How can I get the average visit per day from hit counter ?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Do a query?

  3. #3
    SitePoint Guru
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes do a query.

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    What I meant to say is: can't you give a bit more info? Like your table structure? I immagine you have a table with dates and hits, or something like that?

  5. #5
    SitePoint Guru
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is my table structure. I need to get average visit per day from this table

    Code:
    CREATE TABLE IF NOT EXISTS `hit_counter` (
      `id` int(11) NOT NULL auto_increment,
      `ip` char(33) collate utf8_unicode_ci NOT NULL,
      `first_visit_time` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
      `page_visited` int(11) NOT NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=210 ;
    and some data

    Code:
    INSERT INTO `hit_counter` (`id`, `ip`, `first_visit_time`, `page_visited`) VALUES
    (49, '118.68.208.30', '2010-01-06 17:15:19', 123),
    (45, '118.68.189.173', '2010-01-05 22:29:32', 1),
    (46, '118.68.185.89', '2010-01-06 01:20:15', 1),
    (47, '66.249.71.20', '2010-01-07 05:34:00', 8),
    (48, '65.55.106.180', '2010-01-06 07:26:17', 1),
    (50, '123.20.110.83', '2010-01-06 13:30:38', 20),
    (51, '118.69.35.230', '2010-01-21 11:22:33', 158),
    (52, '123.20.55.207', '2010-01-06 17:01:38', 37),
    (53, '118.68.167.106', '2010-01-06 16:26:25', 1),
    (54, '74.52.245.146', '2010-01-06 18:49:50', 1),
    (55, '222.254.62.49', '2010-01-06 19:08:43', 1),
    (56, '125.212.167.9', '2010-01-06 19:44:05', 7),
    (57, '123.19.43.148', '2010-01-06 19:55:25', 7),
    (58, '118.68.179.52', '2010-01-06 19:51:16', 8),
    (59, '118.68.208.133', '2010-01-07 00:01:56', 128),
    (60, '67.202.56.63', '2010-01-07 02:17:54', 8),
    (61, '66.249.67.68', '2010-01-22 21:08:12', 42),
    (62, '113.166.156.25', '2010-01-07 09:38:03', 1),
    (63, '118.68.131.241', '2010-01-07 11:45:25', 3),
    (64, '65.55.207.46', '2010-01-22 21:31:07', 2),
    (65, '38.105.83.6', '2010-01-07 19:39:45', 33),
    (66, '113.170.119.37', '2010-01-07 21:16:44', 1),
    Appreciate helps.

  6. #6
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Code MySQL:
    SELECT 
        COUNT(*) / COUNT(DISTINCT DATE(first_visit_time)) AS avgvisits
    FROM hit_counter


Bookmarks

Posting Permissions

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