The Arcive of vBulletin Modifications Site. |
|
Details »»
|
|||||||||||||||||||||||||
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?? Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
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]' |
|
#3
|
||||
|
||||
|
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 |
|
#4
|
||||
|
||||
|
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?? |
![]() |
|
|