Jump to content

having a math problem


Iank1968

Recommended Posts

I wasnt sure where this belonged, so I thought I would ask here first.

 

Here is some code that adds log ins, but the amount of logins and the amount it displays are always different.

 

function GetLoginStories ($user) {
  global $bonus_table;
  
  if (!is_numeric ($user))
    return;
    
  $bonus = array ();
  $bonus["bonus"] = array ();
  $result = Query ("SELECT unix_timestamp(date) as date,reg_add,lj_bonus,ic_bonus,hu_bonus,rod_bonus,chr_bonus,val_bonus,bug_bonus,camp_bonus,ch_bonus,coin_bonus,bill_bonus,bd_bonus,bb_bonus,cookie_bonus,metal_bonus,gem_bonus FROM $bonus_table WHERE uid=$user");
  
  $num = mysql_num_rows ($result);
  
  for ($i=0; $i<$num; $i++) {
    $bonus_amt = 25 + mysql_result ($result, $i, "reg_add") + mysql_result ($result, $i, "bb_bonus") * 4 + mysql_result ($result, $i, "cookie_bonus") * 4 + mysql_result ($result, $i, "camp_bonus") * 4 + mysql_result ($result, $i, "bug_bonus") * 4 + mysql_result ($result, $i, "lj_bonus") * 8 + mysql_result ($result, $i, "ic_bonus") * 8 + mysql_result ($result, $i, "hu_bonus") * 8 + mysql_result ($result, $i, "ch_bonus") * 12 + mysql_result ($result, $i, "bd_bonus") * 12 + mysql_result ($result, $i, "rod_bonus") * 12 + mysql_result ($result, $i, "coin_bonus") * 16 + mysql_result ($result, $i, "bill_bonus") * 16 + mysql_result ($result, $i, "chr_bonus") * 50 + mysql_result ($result, $i, "val_bonus") * 25 + mysql_result ($result, $i, "gem_bonus") * 20 + mysql_result ($result, $i, "metal_bonus") * 20;
    //$bonus_amt=5;
    $bonus["bonus"][$i] = array (mysql_result ($result, $i, "date"), "<fb:name uid=\"$user\" /> received $bonus_amt Extremebucks on logon!");
  }

 

hope you can help with this

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/146810-having-a-math-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.