NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page count ip numbers to specific member.

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 10-24-2006, 05:19 PM THREAD STARTER               #1 (permalink)
Straight from Sweden
 
Jawn's Avatar
Join Date: Oct 2006
Location: Sweden
Posts: 202
Jawn has a spectacular aura aboutJawn has a spectacular aura aboutJawn has a spectacular aura about
 


Animal Rescue

count ip numbers to specific member.


Heya all im in need of some help.
Im currently rebuilding my toplist software.
I have over 1200 members, each one got a tracker (image) which stores every unique(IP) that visits their blog. the toplist ranks blogs on unique visitors.

Now im trying to create a php file which should be executed every 30 minutes to rerank the websites on the toplist.

I want this to be so optimized as possible, someone told me about DESTINCT in sql but not sure what he meant.

Got two tables one for members and one for unique ips which are set to be unique.
Not sure how to build it.

Would appreciate if someone could help me.

Best Regards
Jawn
Jawn is offline  
Old 10-24-2006, 07:28 PM   #2 (permalink)
 
BillyConnite's Avatar
Join Date: Jul 2005
Location: Coffs H, Australia
Posts: 3,456
BillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond repute
 


Wildlife Parkinson's Disease Parkinson's Disease
Hey John,

DISTINCT is where SQL will grab only 1 of each value in a table, for example:
????: NamePros.com http://www.namepros.com/programming/250576-count-ip-numbers-to-specific-member.html
Say we had these entries in a table:
1.0.0.0
1.0.0.0
1.2.0.0
1.0.0.0
1.2.6.3

Using DISTINCT would bring up only these results:
1.0.0.0
1.2.0.0
1.2.6.3

Then you can simply use mysql_num_rows to count the number of results given, hence giving you the number of unique IP's.

So, using sql, to get the number of unique IP's could be done like this:
PHP Code:
// grab unique IPs from the table, where the username is 'username'
$sql="select distinct ip from ip_table where username='username' limit 1";
// make sql do it
$result=mysql_query($sql);
// grab the number of rows given (number of unique ip addresses)
$uniques=mysql_num_rows($result); 
Untested, but that should grab the number of unique IP's from a table.

Not sure what topsites you're using, so you would have to alter that obviously for it to work. Not sure how you would rerank the sites though, as I haven't bothered looking into how any of the topsites systems work.

All the best,
Rhett.
Last edited by BillyConnite; 10-24-2006 at 08:05 PM.
BillyConnite is offline  
Old 10-24-2006, 07:45 PM   #3 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
1.0.0.0 is a unique IP many times.. it should still count as a person (or unique IP). [According to what you wrote, it doesn't.]

Also, the last line in your code should be rows, not rwos.
Dan is offline  
Old 10-24-2006, 08:05 PM   #4 (permalink)
 
BillyConnite's Avatar
Join Date: Jul 2005
Location: Coffs H, Australia
Posts: 3,456
BillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond repute
 


Wildlife Parkinson's Disease Parkinson's Disease
Originally Posted by Dan
1.0.0.0 is a unique IP many times.. it should still count as a person (or unique IP). [According to what you wrote, it doesn't.]
????: NamePros.com http://www.namepros.com/showthread.php?t=250576

Also, the last line in your code should be rows, not rwos.
Oops, meant to add 1.0.0.0 in there lol Thanks Dan.
BillyConnite is offline  
Old 10-24-2006, 08:11 PM   #5 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
Alrighty, that was confusing me.
Dan is offline  
Old 10-25-2006, 04:12 AM THREAD STARTER               #6 (permalink)
Straight from Sweden
 
Jawn's Avatar
Join Date: Oct 2006
Location: Sweden
Posts: 202
Jawn has a spectacular aura aboutJawn has a spectacular aura aboutJawn has a spectacular aura about
 


Animal Rescue
Hey guys thanks for taking the time, this is what i have done so far but i very doubt this is the best/fastest way.

$
PHP Code:
count 0;
$data mysql_db_query($databaseName"SELECT site_id, totalunique, uniquehits FROM evots_site WHERE site_id > 0");
while(
$row mysql_fetch_array($data)) {
    
$count ++;
    
$totalUnique    $row['totalunique'];
    
$Unique     $row['uniquehits'];
????: NamePros.com http://www.namepros.com/showthread.php?t=250576
    
$siteID        $row['site_id'];
????: NamePros.com http://www.namepros.com/showthread.php?t=250576

    
$data2 mysql_db_query($databaseName"SELECT ip FROM evots_tracker WHERE site_id=$siteID ORDER BY site_id");
    
$Visits mysql_num_rows($data2);
    Print 
$userID "$count,    TotalUnique $totalUnique     Unique $Unique,     Visits $Visits     SiteID $siteID<br>\n";
    
$updatedUnique $Visits;
    
$totalUnique $totalUnique $Unique $Visits;
    
mysql_db_query($databaseName"UPDATE evots_site SET `uniquehits`='$updatedUnique', totalunique='$totalUnique' WHERE site_id = $siteID");


Jawn is offline  
Old 10-27-2006, 06:15 AM THREAD STARTER               #7 (permalink)
Straight from Sweden
 
Jawn's Avatar
Join Date: Oct 2006
Location: Sweden
Posts: 202
Jawn has a spectacular aura aboutJawn has a spectacular aura aboutJawn has a spectacular aura about
 


Animal Rescue
no one?
Jawn is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 08:48 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger