Professional Web Applications Themes

counting number of unique entries under a column - PHP Development

hi, i am wanting to count the number of unique rows under a certain column. i want to count how many times a page has been accessed. how i plan to do this is every time a page is accessed, a session id variable is checked for. if noe exist, a piece of code will create on. then the session id is store in a table under one column and the pages pre-defined number will be stored under another. so if i want to check how many users have access a page in seperate sessions, all i need to do ...

  1. #1

    Default counting number of unique entries under a column

    hi,
    i am wanting to count the number of unique rows under a certain
    column. i want to count how many times a page has been accessed. how i
    plan to do this is every time a page is accessed, a session id
    variable is checked for. if noe exist, a piece of code will create on.
    then the session id is store in a table under one column and the pages
    pre-defined number will be stored under another. so if i want to check
    how many users have access a page in seperate sessions, all i need to
    do is count how many unique session ids exist for that page (using the
    page number - i.e. SELECT ... WHERE page_id = 8).

    as i mentioned, i dont know how to count how many unique entries their
    are under a column. any ideas??

    also, how is it i check if a variable exists??

    cheers

    burnsy
    mr_burns Guest

  2. #2

    Default Re: counting number of unique entries under a column


    On 8-Oct-2003, [email]bissatchyahoo.co.uk[/email] (mr_burns) wrote:
    > i am wanting to count the number of unique rows under a certain
    > column. i want to count how many times a page has been accessed. how i
    > plan to do this is every time a page is accessed, a session id
    > variable is checked for. if noe exist, a piece of code will create on.
    > then the session id is store in a table under one column and the pages
    > pre-defined number will be stored under another. so if i want to check
    > how many users have access a page in seperate sessions, all i need to
    > do is count how many unique session ids exist for that page (using the
    > page number - i.e. SELECT ... WHERE page_id = 8).
    >
    > as i mentioned, i dont know how to count how many unique entries their
    > are under a column. any ideas??
    assuming mysql:
    $rs = mysql_query("select distinct columnname from tablename where
    page_id=8") or die(mysql_error());
    $num_rows = mysql_num_rows($rs);
    >
    > also, how is it i check if a variable exists??
    if (isset($variablename))
    // $variablename exists
    else
    // it doesn't

    --
    Tom Thackrey
    [url]www.creative-light.com[/url]
    tom (at) creative (dash) light (dot) com
    do NOT send email to [email]jamesbutlerwillglen.net[/email] (it's reserved for spammers)
    Tom Thackrey Guest

  3. #3

    Default Re: counting number of unique entries under a column

    On 8 Oct 2003 17:09:48 -0700, [email]bissatchyahoo.co.uk[/email] (mr_burns) wrote:
    >i am wanting to count the number of unique rows under a certain
    >column. i want to count how many times a page has been accessed. how i
    >plan to do this is every time a page is accessed, a session id
    >variable is checked for. if noe exist, a piece of code will create on.
    >then the session id is store in a table under one column and the pages
    >pre-defined number will be stored under another. so if i want to check
    >how many users have access a page in seperate sessions, all i need to
    >do is count how many unique session ids exist for that page (using the
    >page number - i.e. SELECT ... WHERE page_id = 8).
    >
    >as i mentioned, i dont know how to count how many unique entries their
    >are under a column. any ideas??
    SELECT COUNT(DISTINCT whatever)
    FROM ...
    >also, how is it i check if a variable exists??
    [url]http://www.google.com/search?q=if+a+variable+exists+site:www.php.net&l=e n[/url]

    --
    Andy Hassall (andyandyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
    Space: disk usage ysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
    Andy Hassall Guest

Similar Threads

  1. counting column and getting column names
    By dduck1934 in forum Coldfusion Database Access
    Replies: 0
    Last Post: May 24th, 02:05 PM
  2. counting number of loadVariables vars
    By Dinko81 webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 2
    Last Post: February 6th, 09:57 PM
  3. Counting number of rotations
    By Howdy in forum Macromedia Director Lingo
    Replies: 0
    Last Post: December 10th, 02:23 PM
  4. counting similar entries in a DB
    By Alistair in forum ASP Database
    Replies: 4
    Last Post: October 20th, 07:50 PM
  5. Replies: 2
    Last Post: June 25th, 06:48 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139