detect numbers of views of item/post/job psoting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
avibitton
Forum Newbie
Posts: 18
Joined: Sat Jul 14, 2012 4:35 pm

detect numbers of views of item/post/job psoting

Post by avibitton »

Hi

Im building a job portal website , but i want to add a feture of job views , same like products views on some platforms and same as on forum boards ( views of a post) .
what i need is the code of the views number , if its based on "onclick" event with a counter so its easy but i guess its should be more sufisticated than that,at least i tought so .
i hope someone can help me with this .

thx Avi .
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: detect numbers of views of item/post/job psoting

Post by Christopher »

I assume that you would have a field in either the job table or in a linked table that had an integer field to hold the count. The do something like this every time a job is viewed:

"UPDATE jobs SET jobs.view_count = jobs.view_count + 1 WHERE jobs.id = $job_being_viewed"
(#10850)
Post Reply