The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
|||
|
|||
![]()
No hope in getting this to work eh??? :ermm:
![]() |
#12
|
||||
|
||||
![]()
field7 contains numbers that you want to add up? Then here is the query that would work.
Code:
SELECT SUM(field7) AS total FROM " . TABLE_PREFIX . "userfield |
#13
|
|||
|
|||
![]() Quote:
Code:
// Weight Count $result_allweight = $DB_site->query_first(" SELECT SUM(field7) AS total FROM " . TABLE_PREFIX . "userfield "); /* $result_allweight['total'] */ ![]() |
#14
|
|||
|
|||
![]()
Using that corrected code (in your last post), you must not output the variable $result_allweight, but you must output the variable
PHP Code:
You can also remove those comments; PHP Code:
|
#15
|
|||
|
|||
![]() Quote:
$result_allweight['total'] to my template I get Code:
The following error occurred when attempting to evaluate this template: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING |
#16
|
|||
|
|||
![]()
In my FORUMHOME Template i have :
Code:
$header <center><b>Total Member Weight Loss is :</b> <b><font color="red">$result_allweight</font></b></center> $navbar Code:
// ### START TEST WEIGHT COUNT ########################################## $result_allweight = $DB_site->query_first(" SELECT SUM(field7) AS total FROM " . TABLE_PREFIX . "userfield "); // ### END TEST WEIGHT COUNT############################################# |
#17
|
|||
|
|||
![]()
I guess I should give up on trying to get this working? :disappointed:
|
#18
|
|||
|
|||
![]()
OK well since nobody else seems to know I'll do what I can to help.
One thing I might suggest also, is that you edit the custom profile field 'weight' and add this regular expression in the regular expression field: Code:
^[0-9]*$ Still it is up to you. Now, Lets see if we can't get this query to run successful. I ran apache on my computer to test the query myself, so I should eventually come up with something which I am positive works... I am testing it now while I am typing this message. --- Success so far! < I am now just doing a few quick last minute troubleshooting for any possible errors you may encounter, so I know in advance what to expect... > OK no errors encountered on my part. If any of your users have entered non-integer values for weight, it will omit them from the SUM(). I assumed it would error. Please tell me if this works for you. PHP Code:
Code:
$result_allweight[weight] Well, I hope this helps you, if you have any more troubles, I will see what I can do. Sorry for lengthy delay, it being Xmas and all. PS: Merry Xmas all. |
#19
|
|||
|
|||
![]()
Davey,
I can't thank you enough for not giving up on my problem and making it work.. I just used your code on the site and its working GREAT! ![]() I have one last request if its not to hard to do.. The total weight loss is 2,221 Pounds (See attached image) The total comes up as "2221" is it hard to have it put in the " , " for the 1,000 mark so that it will show "2,221"? If its alot more work then I can deal with it staying the way it is but if its easy to place the " , " It would be great.. Thank for everyone's time that has worked on getting this to work for me.. I can't thank you all enough.. and To Davey please check your PM.. Thanks again!! Crow |
#20
|
|||
|
|||
![]()
I guess no one wants to give this one a try! :ermm:
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|