![]() |
Adding specific count of views
Someone suggested I add the following code if I want to put the totalviews of a forum onto the forumdisplay page, instead of total posts.
SELECT SUM(views) FROM thread I think I need a number value string (right?) - what do you suggest and where can I place it to generate the totalviews? thx for your help - |
Anyone? thx
|
well you'll want to limit that to a specific forum:
[sql]SELECT SUM(views) AS views FROM " . TABLE_PREFIX . "thread WHERE forumid = $forumid[/sql] or, do it with something like GROUP BY forumid. Now that I think about it, the second would be even better :) |
So
SELECT SUM(views) AS views FROM " . TABLE_PREFIX . "thread GROUP BY forumid = $forumid ??? & what table should I add it to in mysql? Will it generate a number I can use in my boards - thx! |
you could cache it in the datastore table...
that should generate a number, which you can call in your boards, but you'll have to fetch it from the database then... |
Thx - is this the correct GROUP BY string?
SELECT SUM(views) AS views FROM " . TABLE_PREFIX . "thread GROUP BY forumid = $forumid & how do I call it back from the datastore? - it doesn't appear to have a name like $threadviews... |
no, just GROUP BY forumid
you'll have to add it to the datastore first |
Bear with me, Colin - sorry for the newbie questions -
So i can put the string into the data store, but how would I have it display within forumdisplay on my board - what do I ask for to get that value? i.e. $threadviews Thx |
All times are GMT. The time now is 04:43 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|