![]() |
i make this code
$boardviews = $DB_site->query_first("SELECT SUM(views) AS totalviews FROM thread"); $totalviews = number_format($boardviews[totalviews]); $countviews=$DB_site->query_first("SELECT count(views) AS views FROM thread WHERE postuserid='$bbuserinfo[userid]'"); $myviews=number_format($countviews[views]); $percentviews = round(($myviews / $totalviews) * 100,2); but it always show up the same number~~ what's wrong?? |
1. number_format() adds commas to the number and thus you won't be able to use it correctly in mathematic operations. So don't number_format() $boardviews[totalviews] or $countviews[views] before calculating $percentviews.
2. This: Code:
SELECT [high]count[/high](views) AS views FROM thread WHERE postuserid='$bbuserinfo[userid]' |
oh~~~but i change this code
$boardviews = $DB_site->query_first("SELECT SUM(views) AS totalviews FROM thread"); $totalviews = $boardviews['totalviews']; $countviews=$DB_site->query_first("SELECT SUM(views) AS views FROM thread WHERE postuserid='$bbuserinfo[userid]'"); $myviews=$countviews['views']; $percentviews = round(($myviews / $totalviews) * 100,2); but the have same problem PS:i user this code in member.php |
i think the problem is this code
$countviews=$DB_site->query_first("SELECT SUM(views) AS views FROM thread WHERE postuserid='$bbuserinfo[userid]'"); $myviews=$countviews['views']; it only can show up admin's views~~~ any idea?? |
All times are GMT. The time now is 10:03 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:
|