Show most visited links

This is a discussion on "Show most visited links" within the PHP Forum section. This forum, and the thread "Show most visited links are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 28th, 2007, 14:32
New Member
Join Date: Dec 2006
Location: Sweden
Age: 54
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Show most visited links

I have a webpage with links which I wish to make a top ten-list of so I need a script that will do the job for me

If anyone have a tip how to do this it would be of great help. Thanks
Reply With Quote

  #2 (permalink)  
Old Aug 28th, 2007, 15:33
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show most visited links

i think that this would require you to add to a mysql record every time i page is loaded.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #3 (permalink)  
Old Aug 28th, 2007, 15:33
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show most visited links

do you know how to create mysql tables?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #4 (permalink)  
Old Aug 28th, 2007, 17:03
New Member
Join Date: Dec 2006
Location: Sweden
Age: 54
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Show most visited links

Thanks for reply!
I have a database but I don't know how to make a table in it.
I only have permission to one database.

I found a script called GoLinks but I get stuck when it comes to create a table in my database.
GoLinks seems good but I don't need all of the stuff that comes with it

Last edited by berraf; Aug 28th, 2007 at 17:20.
Reply With Quote
  #5 (permalink)  
Old Aug 28th, 2007, 17:43
Reputable Member
Join Date: Apr 2007
Location: Scotland
Age: 17
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Blake121
Re: Show most visited links

Do you know if your server has phpMyAdmin installed?

That is the easiest way to work with MySQL databases. It does all the work for you

otherwise your going to have to learn some SQL, you can learn through some of these sites.

http://www.w3schools.com/sql/default.asp
http://sqlcourse.com
http://www.sql-tutorial.net
Reply With Quote
  #6 (permalink)  
Old Aug 28th, 2007, 18:04
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show most visited links

make a database called web (or something) and I can make a quick code for you
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #7 (permalink)  
Old Aug 28th, 2007, 19:43
New Member
Join Date: Dec 2006
Location: Sweden
Age: 54
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Show most visited links

Quote:
Originally Posted by alexgeek View Post
make a database called web (or something) and I can make a quick code for you
Okey, I've made the database and would really appreciate the code from you
Reply With Quote
  #8 (permalink)  
Old Aug 28th, 2007, 20:33
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show most visited links

alright then,
5 mins.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #9 (permalink)  
Old Aug 28th, 2007, 20:38
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show most visited links

save this as createtable.php then run it, if you get errors tell me.
PHP: Select all

<?php
mysql_connect 
('localhost''put_username_here''put_password_here') ;
mysql_select_db ('web');

$sql "create table users (pagename varchar (255), hits int (20) default '0');";
mysql_query($sql) or die(mysql_error());
echo 
"table made";
?>
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #10 (permalink)  
Old Aug 29th, 2007, 05:50
New Member
Join Date: Dec 2006
Location: Sweden
Age: 54
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Show most visited links

The script works like a clock! Thanks!

How can I go on from here?
Reply With Quote
  #11 (permalink)  
Old Aug 29th, 2007, 06:01
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show most visited links

Okay, I've been up all night.
not slept
I'm off to bed, and I'll do the rest for you in a few hours
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #12 (permalink)  
Old Aug 29th, 2007, 23:49
Reputable Member
Join Date: Apr 2007
Location: Scotland
Age: 17
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Blake121
Re: Show most visited links

Well I won't actually write the script for you. We encourage learning by yourself here

I can however give you some pointers though

I'd have a table with these fields: id|url|hits

Then the link on the page would be something like this "outgoing.php?id=1"

Then the outgoing.php script would extract the url from the database with the matching id as the one in ?id=x

If a match is found you then update hits to add one on.

If all go well you then redirect to the url (using header() function) which you have just pulled out of the database.

This may not be the best way of doing it but it will work.

Hope this will help ya out,

Blake
Reply With Quote
  #13 (permalink)  
Old Aug 29th, 2007, 23:54
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show most visited links

Quote:
Originally Posted by Blake121 View Post
Well I won't actually write the script for you. We encourage learning by yourself here

I can however give you some pointers though

I'd have a table with these fields: id|url|hits

Then the link on the page would be something like this "outgoing.php?id=1"

Then the outgoing.php script would extract the url from the database with the matching id as the one in ?id=x

If a match is found you then update hits to add one on.

If all go well you then redirect to the url (using header() function) which you have just pulled out of the database.

This may not be the best way of doing it but it will work.

Hope this will help ya out,

Blake
or instead of headers and stuff.
you could just include a script on every page you want ranked,
and that script would add one to the table.
a lot easier
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #14 (permalink)  
Old Aug 30th, 2007, 00:12
Reputable Member
Join Date: Apr 2007
Location: Scotland
Age: 17
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Blake121
Re: Show most visited links

Yeah but what's the script gonna do? hows it gonna know what link you clicked and which one to add a hit onto?

Unless you used AJAX. But that's probably more bother than it's worth lol
Reply With Quote
  #15 (permalink)  
Old Aug 30th, 2007, 00:29
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show most visited links

you don't have to know which link you clicked
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #16 (permalink)  
Old Aug 30th, 2007, 00:30
Reputable Member
Join Date: Apr 2007
Location: Scotland
Age: 17
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Blake121
Re: Show most visited links

Why not? There's a big list of them on the page.

You'll need to know which url it is in question

Did you look at the link they posted lol

Last edited by Blake121; Aug 30th, 2007 at 00:34.
Reply With Quote
  #17 (permalink)  
Old Aug 30th, 2007, 01:49
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show most visited links

but if you put the script on every page, it will put itself in the database,
using $_SERVER['REQUEST_URI']
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #18 (permalink)  
Old Aug 30th, 2007, 06:32
New Member
Join Date: Dec 2006
Location: Sweden
Age: 54
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Show most visited links

Well I'm a total newbie so it would take me to much time to learn to do this script so it would be great if I could get that help
Reply With Quote
  #19 (permalink)  
Old Aug 30th, 2007, 06:43
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show most visited links

okay.
These links, are they links to other pages on your website or links to other websites?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #20 (permalink)  
Old Aug 30th, 2007, 06:45
New Member
Join Date: Dec 2006
Location: Sweden
Age: 54
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Show most visited links

Alex, It's links to other websites...
Reply With Quote
Reply

Tags
count, links

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find out who's visited my profile? Stormraven Webforumz Cafe 2 May 18th, 2008 03:08
[SOLVED] How can I get more links to my website to show up on Google SERP. Spyros Search Engine Optimization (SEO) 2 Nov 19th, 2007 22:29
a:link, active, hover, visited.... mcdanielnc89 Web Page Design 35 Nov 8th, 2007 22:10
A.Visited problems... JustinStudios Web Page Design 5 Apr 3rd, 2007 06:29
PR4 links for sale...links in an excellent position agent14 Link Building and Link Sales 1 Mar 5th, 2007 21:33


All times are GMT. The time now is 02:15.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

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