mike3800 Posted March 24, 2007 Share Posted March 24, 2007 if ($gp['gp_pay']) {$gp_pay="<a href='yourgang.php?action=staff&act2=masspayment'>Mass Payment</a>";} if ($gp['gp_pay']) {$gp_pay="<a href='yourgang.php?action=staff&act2=masscpayment'>Mass Crystal Payment</a>";} im sure you can see i am attempting to make an otion for a mass cash and mass crystal payout in a game the mass cash payout was in the game and functional. when i added the crystal code, the link for the mass cash payment disappeared. i think my problem is in the code above, but im very new at this and not too sure what to do. the mass crystal payout works fine Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/ Share on other sites More sharing options...
MadTechie Posted March 24, 2007 Share Posted March 24, 2007 erm.. shouldn't <?php <a href='yourgang.php?action=staff&act2=masspayment'>Mass Payment[/url] ?> be <?php <a href='yourgang.php?action=staff&act2=masspayment'>Mass Payment</a> ?> Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214041 Share on other sites More sharing options...
mike3800 Posted March 24, 2007 Author Share Posted March 24, 2007 i think the forum added that if ($gp['gp_pay']) {$gp_pay="<a href='yourgang.php?action=staff&act2=masspayment'>Mass Payment</a>";} if ($gp['gp_pay']) {$gp_pay="<a href='yourgang.php?action=staff&act2=masscpayment'>Mass Crystal Payment</a>";} yeah, the forum changed it. i just checked and recopied and pasted and after i submitted, it made it /url Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214044 Share on other sites More sharing options...
MadTechie Posted March 24, 2007 Share Posted March 24, 2007 i am refering to the [/url] not being a </a> paste it in again but before posting, select the code and click the # button Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214046 Share on other sites More sharing options...
mike3800 Posted March 24, 2007 Author Share Posted March 24, 2007 if ($gp['gp_oc']) {$gp_oc="<a href='yourgang.php?action=staff&act2=crimes'>Organised Crimes</a>";} if ($gp['gp_pay']) {$gp_pay="<a href='yourgang.php?action=staff&act2=masspayment'>Mass Payment</a>";} there we go Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214049 Share on other sites More sharing options...
mike3800 Posted March 24, 2007 Author Share Posted March 24, 2007 thats how it looks Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214050 Share on other sites More sharing options...
HaLo2FrEeEk Posted March 24, 2007 Share Posted March 24, 2007 It is becuase basically you are checking the same thing twice: if ($gp['gp_pay']) {$gp_pay="<a href='yourgang.php?action=staff&act2=masspayment'>Mass Payment</a>";} if ($gp['gp_pay']) {$gp_pay="<a href='yourgang.php?action=staff&act2=masscpayment'>Mass Crystal Payment</a>";} you are checking against $gp['gp_pay'] twice, so first it is setting it to the mass payment link, then (since it is still true) it is setting it to the mass crystal payment, you either need to make two different variables in the (I assume youa re using an array) one for each mass pay and mass crystal, or append the mass crystal to the mass payment. Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214052 Share on other sites More sharing options...
MadTechie Posted March 24, 2007 Share Posted March 24, 2007 :-X How did i not spot that... it was either the 5am time here making me think it was echoing.. if ($gp['gp_pay']) {$gp_pay="<a href='yourgang.php?action=staff&act2=masspayment'>Mass Payment</a>";} if ($gp['gp_pay']) {$gp_pay="<a href='yourgang.php?action=staff&act2=masscpayment'>Mass Crystal Payment</a>";} change the 2nd $gp_pay to $gp_payc (or whatever) the find where $gp_pay is being used and repeat for $gp_payc, (credit to HaLo2FrEeEk ) Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214053 Share on other sites More sharing options...
mike3800 Posted March 24, 2007 Author Share Posted March 24, 2007 can i just change it to ($gp['gp_payc]) {$gp_payc=" etc etc etc Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214055 Share on other sites More sharing options...
mike3800 Posted March 24, 2007 Author Share Posted March 24, 2007 lol. you beat me to it. ill try that Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214057 Share on other sites More sharing options...
mike3800 Posted March 24, 2007 Author Share Posted March 24, 2007 i must be stupid. i see the 2 places in the code i posted where i need to change it to "payc", but i cant find it anywhere else Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214058 Share on other sites More sharing options...
HaLo2FrEeEk Posted March 24, 2007 Share Posted March 24, 2007 Try not to triple post. Don't forget that if you set it to a different variable you need to echo both variables, so if you use $gp_payc and $gp_pay, you need to echo both $gp_payc and $gp_pay. Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214068 Share on other sites More sharing options...
mike3800 Posted March 24, 2007 Author Share Posted March 24, 2007 Try not to triple post. Don't forget that if you set it to a different variable you need to echo both variables, so if you use $gp_payc and $gp_pay, you need to echo both $gp_payc and $gp_pay. sorry about the posts. this is frustrating me a little. lol if ($gp['gp_pay']) {$gp_pay="<a href='yourgang.php?action=staff&act2=masspayment'>Mass Payment</a>";} if ($gp['gp_payc']) {$gp_payc="<a href='yourgang.php?action=staff&act2=masscpayment'>Mass Crystal Payment</a>";} thats what it looks like now. is there somewhere else i need to change gp_pay to gp_payc? i cant find anywhere else Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214313 Share on other sites More sharing options...
wildteen88 Posted March 24, 2007 Share Posted March 24, 2007 Does $gp['gp_payc'] even exist? What sort of data does $gp['gp_pay'] hold? Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214317 Share on other sites More sharing options...
mike3800 Posted March 24, 2007 Author Share Posted March 24, 2007 i dont know. lol. im really new at this and just trying to understand what im doing wrong case "masspayment"; gang_staff_masspayment(); break; function gang_staff_masspayment() { global $ir,$c,$userid,$gangdata,$gp; if (!$gp['gp_pay']) { print "You do not have access to this function!<br /><br /> <a href='yourgang.php'>Back</a>"; die (); } $_POST['amnt']=abs((int) $_POST['amnt']); if($_POST['amnt']) { $q=mysql_query("SELECT * FROM users WHERE gang={$ir['gang']}",$c); while($r=mysql_fetch_array($q)) { if($gangdata['gangMONEY'] >= $_POST['amnt']) { event_add($r['userid'],"You were given \${$_POST['amnt']} from your gang.",$c); mysql_query("UPDATE users SET money=money+{$_POST['amnt']} WHERE userid={$r['userid']}", $c); $gangdata['gangMONEY']-=$_POST['amnt']; print "Money sent to {$r['username']}.<br />"; } else { print "Not enough in the vault to pay {$r['username']}!<br />"; } } mysql_query("UPDATE gangs SET gangMONEY={$gangdata['gangMONEY']} WHERE gangID={$ir['gang']}", $c); mysql_query("INSERT INTO gangevents VALUES('',{$ir['gang']},unix_timestamp(), 'A mass payment of \${$_POST['amnt']} was sent to the members of the Family.')",$c); print "Mass payment sending complete!<br /> <a href='yourgang.php'>> Back</a>"; } else { print "<b>Mass Payment</b><br /> <form action='yourgang.php?action=staff&act2=masspayment' method='post'> Amount: <input type='text' name='amnt' /> <input type='submit' value='Send' /></form>"; } } case "masscpayment"; gang_staff_masscpayment(); break; function gang_staff_masscpayment() { global $ir,$c,$userid,$gangdata; if (!$gp['gp_payc']) { print "You do not have access to this function!<br /><br /> <a href='yourgang.php'>Back</a>"; die (); } $_POST['amnt']=abs((int) $_POST['amnt']); if($_POST['amnt']) { $q=mysql_query("SELECT * FROM users WHERE gang={$ir['gang']}",$c); while($r=mysql_fetch_array($q)) { if($gangdata['gangCRYSTALS'] >= $_POST['amnt']) { event_add($r['userid'],"You were given {$_POST['amnt']}crystals from your gang.",$c,'gang'); mysql_query("UPDATE users SET crystals=crystals+{$_POST['amnt']} WHERE userid={$r['userid']}", $c); $gangdata['gangCRYSTALS']-=$_POST['amnt']; print "crystals sent to {$r['username']}.<br />"; } else { print "Not enough in the vault to pay {$r['username']}!<br />"; } } mysql_query("UPDATE gangs SET gangCRYSTALS={$gangdata['gangCRYSTALS']} WHERE gangID={$ir['gang']}", $c); mysql_query("INSERT INTO gangevents VALUES('',{$ir['gang']},unix_timestamp(), 'A mass payment of {$_POST['amnt']} crystals was sent to the members of the Gang.')",$c); print "Mass crystal payment sending complete!<br /> <a href='yourgang.php?action=staff'>> Back</a>"; } else { print "<h3>Mass Crystal Payment</h3> How many crystals do you want to give to each member?<br /> There are currently {$gangdata['gangCRYSTALS']} in the gang.<br /><br /> <form action='yourgang.php?action=staff&act2=masscpayment' method='post'> Amount:<br /> <input type='text' name='amnt' /> <input type='submit' value='Send' /></form>"; } } those are the code for the mass cash payment and mass crystal payment Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214322 Share on other sites More sharing options...
HaLo2FrEeEk Posted March 25, 2007 Share Posted March 25, 2007 I didn't read the code, but $gp[gp_pay] is an array, the array's name is $gp, it this array does not exist, calling it up will do nothing, you need to create an associative array (thats what this is) with the values (at least) gp_pay and gp_payc. When a variable is called up in php, if it exists, the value in it is used, if it does not exist, it is created then the value returned, often times, it is created empty or null. Quote Link to comment https://forums.phpfreaks.com/topic/44085-solved-what-am-i-doing-wrong-here/#findComment-214626 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.