Jump to content
MakeWebGames

Gang OC not working


jds137

Recommended Posts

Is there anything I need changed in the following snippet of code? When I go the OC part in my gang, there are no crimes listed?

 

}
}
function gang_staff_orgcrimes()
{
global $db,$ir,$c,$userid,$gangdata;
$_POST['crime'] = abs((int) $_POST['crime']);
if($_POST['crime'])
{
if($gangdata['gangCRIME'] != 0)
{
print "Your gang is already doing a crime!";
}
else
{
$db->query("UPDATE gangs SET gangCRIME={$_POST['ocNAME']},gangCHOURS=24 WHERE gangID={$ir['gang']}");
print "You have started to plan this crime. It will take 24 hours.";
}
}
else
{
print "<h3>Organised Crimes</h3>
<form action='yourgang.php?action=staff&act2=crimes' method='post'>Choose a crime that your gang should commit.

<select name='crime' type='dropdown'>";
$cnt=$db->query("SELECT username FROM users WHERE gang={$gangdata['gangID']}");
$membs=$db->num_rows($cnt);
$q=$db->query("SELECT * FROM orgcrimes WHERE ocUSERS <= $membs");
while($r=$db->fetch_row($q))
{
print "<option value='{$r['ocID']}'>{$r['ocNAME']} ({$r['ocUSERS']} members needed)</option>";
}
print "</select>
<input type='submit' value='Commit' /></form>";
}
}
Link to comment
Share on other sites

  • 3 months later...

Re: Gang OC not working

oops, thinking of the negative bug...never mind. what needs fixed in this:

 

mysql_query("UPDATE gangs SET gangCHOURS=gangCHOURS-1 WHERE gangCRIME>0");
$q=mysql_query("SELECT g.*,oc.* FROM gangs g LEFT JOIN orgcrimes oc ON g.gangCRIME=oc.ocID WHERE g.gangCRIME > 0 AND g.gangCHOURS = 0");

 

to keep it from going into the negative?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...