Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)

Reply
 
Thread Tools Display Modes
  #1  
Old 02-20-2003, 10:10 AM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Hack Help

I have this new fields in my user table called QUADS and BIKES

In my getinfo I have them showing statistically.

Quads: 2
Bikes: 5

The counter counts threads made in certain forum ids.

What I want to do is have something showing the average amount of Quad and Bike posts per month.

I only can come up with this.

PHP Code:
  $qbtime = (time() - $userinfo[joindate]) / 2592000// Days Joined
  
if ($qbtime 1) { // User has been a member for less than one day.
    
$qbpermonth "$userinfo[quads]";
  } else {
    
$qbpermonth sprintf("%.2f",($userinfo[quads] / $qbtime));
  } 
This only does the monthly average of quads and not quads and bikes combined.

I dont no how to combine both values of quads and bikes and average a monthly value to it.

That what I need help on. I hope someone understands me hehe.
Reply With Quote
  #2  
Old 02-20-2003, 11:12 AM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you add them with a +
so something like this:
PHP Code:
$qbpermonth $other_variable;
$qbpermonth $string
Reply With Quote
  #3  
Old 02-20-2003, 11:16 AM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well the variable is this.

$userinfo[quads]

and this

$userinfo[bikes]

So how would the code look in full. That is sorta what I am looking for hehe. Thanks for helping.
Reply With Quote
  #4  
Old 02-20-2003, 11:21 AM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$qbtime = (time() - $userinfo[joindate]) / 2592000// Days Joined
  
if ($qbtime 1) { // User has been a member for less than one day.
    
$userinfo[quads] += $userinfo[bikes];
    
$qbpermonth "$userinfo[quads]";
  } else {
    
$qbpermonth sprintf("%.2f",($userinfo[quads] / $qbtime));
  } 
Reply With Quote
  #5  
Old 02-20-2003, 11:23 AM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I dont see how that would work in any way just by looking at it though?

unless maybe it should be this

$userinfo[quadsandbikes] = $userinfo[quads] + $userinfo[bikes];

I could try that.
Reply With Quote
  #6  
Old 02-20-2003, 11:25 AM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

huh? now you have $userinfo[quadsandbikes] ???

I missed a = in the code.. i edited it.


this is how adding works, try it in a test file:

PHP Code:
<?php 

$count 
10;
$more 23;
$count += $more;

echo 
"$count";

?>
you get 33. Just as your doing, adding one $variable with another.
Reply With Quote
  #7  
Old 02-20-2003, 11:36 AM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i tried the code you mentioned up a few and it still doesnt work. It only shows the monthly average for just quads.

say quads counter was 5
and bikes counter was 10

the average would be 7.5

It is still not adding both values together as one.
Reply With Quote
  #8  
Old 02-20-2003, 11:38 AM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

try this.

PHP Code:

$qbtime 
= (time() - $userinfo[joindate]) / 2592000// Days Joined
  
if ($qbtime 1) { // User has been a member for less than one day.
    
$qbpermonth += $userinfo[quads] + $userinfo[bikes];
  } else {
    
$qbpermonth sprintf("%.2f",( $qbpermonth $qbtime));
  } 
Reply With Quote
  #9  
Old 02-20-2003, 11:39 AM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I understand what you mean by that test thing u told me to do. It works it sasys 33 but the thing is the variables are getting pulled from the database on the board but your variables have values right there in the php already. I don't know if that is causing a conflict though maybe?
Reply With Quote
  #10  
Old 02-20-2003, 11:41 AM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nope that did not work neither. Same thing. Just showing the average for the quads.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:55 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05789 seconds
  • Memory Usage 2,268KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete