By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,678 Members | 1,287 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,678 IT Pros & Developers. It's quick & easy.

counting number of unique entries under a column

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

On 8-Oct-2003, bi******@yahoo.co.uk (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
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #2

P: n/a
On 8 Oct 2003 17:09:48 -0700, bi******@yahoo.co.uk (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??


http://www.google.com/search?q=if+a+...w.php.net&l=en

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.