Any help on this matter will be rewarded with reputation points. Say I had 20 links on a page. How can I count which ones have been clicked on the most? Then, how can I select the 5 most popular?
There's a number of ways but the simplest would be to create a table and track which link is clicked as well as incrementing the number of clicks.. Then to select the 5 most popular you could use an sql statement like SELECT link FROM tbl_links ORDER BY clicks DESC LIMIT 5 to grab the 5 most clicked links
you will have to make a table and each page will be redirected through any other page e.g. redirect.php?url=http://www.google.com and htis page will save details in database, then you can fetch those details and see..
OK. I understand the MySQL SELECT part, but not how the clicks are going to be added to the table. Let's say that all of my links are in a table. First, I will have to add another column to the table and call it something like Clicks, right? Then, how do I get each click to be added to the respective link's row? When someone clicks on the link, they're just going to be directed to wherever the URL points. How am I going to add the click to the table? Sorry, Darkblue, but I don't understand what you mean. Note that I am but a mere blundering novice at PHP, having just started learning this week!
Yes you are right. You need a PHP script to insert or increase the Clicks when user clicking on the link. Link_ID Link_URL Clicks 1 http://google.com 1 Then your link URL can be like this: http://yourdomain.com/goto.php?link_id=1 In your goto.php you just need to add an SQL statement to increase the Clicks and redirect user to the URL.
Google analytics and other stats tools is OK. analytics the stats report and find out what are the visitor interested in and which are most clicked.
So, let me get this straight . . . I need to create a page for every individual URL. When visitors click on a URL, they will be taken to its respective page, where a script will log the click and add it to the table, before redirecting the visitor to the original destination. Is that correct? If so, I'm afraid it's a bit too impractical a method. I will eventually have 1,000s of URLs in my database. I can't create a seperate "log and redirect" page for each one.