Iank1968 Posted February 25, 2009 Share Posted February 25, 2009 this code is supose to add everything together and display it on a feed but it doesnt add past the 25 bonus. heres the code 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!"); } can anyone help me as to why its not adding past the $bonus_amt = 25 + mysql_result ($result, $i, "reg_add") thanks Quote Link to comment https://forums.phpfreaks.com/topic/146908-having-a-bonus-math-problem-here/ Share on other sites More sharing options...
sasa Posted February 25, 2009 Share Posted February 25, 2009 what function Query do? what data is in field 'reg_add'? Quote Link to comment https://forums.phpfreaks.com/topic/146908-having-a-bonus-math-problem-here/#findComment-771322 Share on other sites More sharing options...
Iank1968 Posted February 25, 2009 Author Share Posted February 25, 2009 Thats what im trying to figure out Quote Link to comment https://forums.phpfreaks.com/topic/146908-having-a-bonus-math-problem-here/#findComment-771323 Share on other sites More sharing options...
Iank1968 Posted February 25, 2009 Author Share Posted February 25, 2009 can you please help me get this right? Quote Link to comment https://forums.phpfreaks.com/topic/146908-having-a-bonus-math-problem-here/#findComment-771331 Share on other sites More sharing options...
sasa Posted February 25, 2009 Share Posted February 25, 2009 try to print_r($bonus); just after for loop Quote Link to comment https://forums.phpfreaks.com/topic/146908-having-a-bonus-math-problem-here/#findComment-771353 Share on other sites More sharing options...
Iank1968 Posted February 25, 2009 Author Share Posted February 25, 2009 in the reg_add is the bonus for the extra 1 EO$ per 100 played Iam trying your suggestion, will let you know how it works out Quote Link to comment https://forums.phpfreaks.com/topic/146908-having-a-bonus-math-problem-here/#findComment-771397 Share on other sites More sharing options...
Iank1968 Posted February 25, 2009 Author Share Posted February 25, 2009 did what you said and its only printing array Quote Link to comment https://forums.phpfreaks.com/topic/146908-having-a-bonus-math-problem-here/#findComment-771400 Share on other sites More sharing options...
Iank1968 Posted February 25, 2009 Author Share Posted February 25, 2009 All I want it to do is take this line $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; add all that together for each player and display it on the main page Quote Link to comment https://forums.phpfreaks.com/topic/146908-having-a-bonus-math-problem-here/#findComment-771426 Share on other sites More sharing options...
sasa Posted February 25, 2009 Share Posted February 25, 2009 ok and what is in array Quote Link to comment https://forums.phpfreaks.com/topic/146908-having-a-bonus-math-problem-here/#findComment-771430 Share on other sites More sharing options...
Iank1968 Posted February 25, 2009 Author Share Posted February 25, 2009 if you mean the prize amounts for each prize? Quote Link to comment https://forums.phpfreaks.com/topic/146908-having-a-bonus-math-problem-here/#findComment-771434 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.