vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Hack Help (https://vborg.vbsupport.ru/showthread.php?t=49145)

BigJohnson 02-20-2003 10:10 AM

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. :D

Sebastian 02-20-2003 11:12 AM

you add them with a +
so something like this:
PHP Code:

$qbpermonth $other_variable;
$qbpermonth $string


BigJohnson 02-20-2003 11:16 AM

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.

Sebastian 02-20-2003 11:21 AM

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));
  } 


BigJohnson 02-20-2003 11:23 AM

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.

Sebastian 02-20-2003 11:25 AM

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.

BigJohnson 02-20-2003 11:36 AM

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.

Sebastian 02-20-2003 11:38 AM

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));
  } 


BigJohnson 02-20-2003 11:39 AM

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?

Sebastian 02-20-2003 11:41 AM

did you try the last bit i posted?


All times are GMT. The time now is 06:59 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
  • Page Generation 0.01124 seconds
  • Memory Usage 1,743KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete