Member Avatar for Big-D2xL

Hi, I know this forum for a while and it has been helping me for a time, now I registered myself and I have a question to make you:

I'm making a zone in my website where I can see a Top10 of links, products and news, and all of the info is saved in a MySql db the question/problem is that I want to see how many times a determined thing was seen per hour.


e.g. between 1am and 2 am link1 was visited 11 times.

Any sugestions?

Thanks, in advance.

Recommended Answers

All 2 Replies

You could make an additional table in your database where you store a linkname and a counter? Each time someone clicks a link, you update the table.

example:

table (link_visits) =

link(varchar)           |  visits (integer)
-------------------------------------------------
contact                 |   1
other_page              |   12
function UpdateCounter($link_name) {
     $query = "update link_visits set visits = 
                      ((select visits from link_visits where link = '".$link_name."') + 1)";
    //etc
}
Member Avatar for Big-D2xL

I was actually thinking about doing that, when you told me that, I did it and for now it´s working like a charm. I implemented some other stuff I wanted and its rollin'. Thanks for the sugestion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.