![]() |
I want to give members the satisfaction of seeing how many views all their posts have received.
i.e. Total views of all your posts: 34500 Anyone one know if this hack has been done? |
So, to sum all the views of the threads started by the person viewing the page? Not hard at all.
Tell me if this is what you want. :) |
I was going to put this information in their control panel, for each members own private reference.
|
I have just realized that this is a more important requirement for my message boards then I thought.
If no one knows how to do it, can anyone point me to a hack that is similar? I must say, that this would be a great hack. - It could double for a points program. - The person must be the thread starter however to count the impressions towards their total... thanks. |
Something like this:
PHP Code:
|
Code:
$yourviews=$DB_site->query_first("SELECT SUM(views) AS totalviews FROM thread WHERE postuserid='$bbuserinfo[userid]'"); |
OK, how about a short, quick explanation of "query_first".
|
$DB_site->query() is just like mysql_query().
$DB_site->query_first() is the same as the above, only it returns the first row in the result. For example if you want to find out someone's username, you can do this: Code:
$userinfo=$DB_site->query_first("SELECT username FROM user WHERE userid='$userid'"); But if you do it this way (the wrong way): Code:
$userinfo=$DB_site->query("SELECT username FROM user WHERE userid='$userid'"); You must do $DB_site->fetch_array(), because the result in this case it a 2D array. Am I making sense here? :) |
Thanks Firefly, learned something 2day :)
Why not making a new forum where the php guys can add their little tutorials like this one above? ;) |
Quote:
One more question, which file is this object defined in? Thank You :D |
All times are GMT. The time now is 07:33 AM. |
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:
|