jds137 Posted August 10, 2008 Posted August 10, 2008 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>"; } } Quote
Spudinski Posted August 10, 2008 Posted August 10, 2008 Re: Gang OC not working * Topic Moved * Is there any errors that is appearing near that section? It could help to also give debugging information such as what the query array contains. Quote
jds137 Posted August 13, 2008 Author Posted August 13, 2008 Re: Gang OC not working I fixed them myself Quote
castle Posted November 23, 2008 Posted November 23, 2008 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? Quote
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.