Jump to content

help.


seany123

Recommended Posts

okay when i run the script im making it so $Mamount is bigger than $gang['money']

 

 

so this code should echo the $errmsg and not run any queries or echo anything afterwards.

 

else if (isset($_POST['Mamount']) && $_POST['Mamount'] < $gang['money'])
{
	/**
	 * WHERE IS $gang['money'] set??
	 */
	$errmsg .= "You cannot send this amount of Money!<p />";
	$error = 1;
} 
else 
{

 

but it does... its still running and echoing the following code...

 

 

if (isset($_POST['Mamount']) && $_POST['Mamount'] >= $gang['money'])
		{   
			$query = $db->execute("update `gangs` set `money`=? where `id`=?", array($gang['money'] - $Mamount, $player->gang_id));
			$query1 = $db->execute("update `players` set `money`=? where `username`=?", array($member['money'] + $Mamount, $member['username']));
			$logmsg = "You were given <b>$" . number_format($Mamount) . "</b> money from <b>". $gang['name'] ."</b>.";
			addlog($member['id'], $logmsg, $db);
			$msg .= "You have transferred <b>" . number_format($Mamount) . "</b> points to <b>$username</b>.<p />";

 

 

 

EDIT: oops i may have found the problem >.<

Link to comment
https://forums.phpfreaks.com/topic/161307-help/page/2/#findComment-851673
Share on other sites

okay when i run the script im making it so $Mamount is bigger than $gang['money']

 

so this code should echo the $errmsg and not run any queries or echo anything afterwards.

 

$Mamount isn't being used in this code but let assume you mean $_POST['Mamount']

 

else if (isset($_POST['Mamount']) && $_POST['Mamount'] < $gang['money'])

but it does... its still running and echoing the following code...

 

Erm... but

$_POST['Mamount'] < $gang['money']

means if $_POST['Mamount'] is less then $gang['money'] report and error BUT you are say it should be the other away around!

 

Which you did test here doesn't make any sense as for it to get here it must fail! as condition!

if (isset($_POST['Mamount']) && $_POST['Mamount'] >= $gang['money'])

 

BUT theirs no point checking your same logic twice so just remove the incorrect one!

 

Link to comment
https://forums.phpfreaks.com/topic/161307-help/page/2/#findComment-851772
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.