benlakaz Posted August 8, 2009 Share Posted August 8, 2009 Hello to All, Pls help me with this error that I received when I accept Gang Surrenders. QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Query was SELECT * FROM gangwars where warID= What part should I edit in this area.. Thanks in advance.. function gang_staff_viewsurrenders() { global $db,$ir,$c,$userid,$gangdata; if(!isset($_POST['subm'])) { print "<form action='yourgang.php?action=staff&act2=viewsurrenders' method='post'> Choose who to accept the surrender from. <input type='hidden' name='subm' value='submit' /> Gang: <select name='sur' type='dropdown'>"; $wq=$db->query("SELECT s.*,w.* FROM surrenders s LEFT JOIN gangwars w ON s.surWAR=w.warID WHERE surTO={$ir['gang']}"); while($r=$db->fetch_row($wq)) { if($gangdata['gangID'] == $r['warDECLARER']) { $w="You";$f="warDECLARED"; } else { $w="Them";$f="warDECLARER"; } $ggq=$db->query("SELECT * FROM gangs WHERE gangID=".$r[$f]); $them=$db->fetch_row($ggq); print "<option value='{$r['surID']}'>War vs. {$them['gangNAME']} (Msg: {$r['surMSG']})</option>"; } print "</select> <input type='submit' value='Accept Surrender' /></form>"; } else { $_POST['sur'] = abs((int) $_POST['sur']); $q=$db->query("SELECT surWAR FROM surrenders WHERE surID={$_POST['sur']}"); list($_POST['war']) = $db->fetch_row($q); $wq=$db->query("SELECT * FROM gangwars where warID={$_POST['war']}"); $r=$db->fetch_row($wq); if($gangdata['gangID'] == $r['warDECLARER']) { $w="You";$f="warDECLARED"; } else { $w="Them";$f="warDECLARER"; } $db->query("DELETE FROM surrenders WHERE surID={$_POST['sur']}"); $db->query("DELETE FROM gangwars WHERE warID={$_POST['war']}"); $ggq=$db->query("SELECT * FROM gangs WHERE gangID=".$r[$f]); $them=$db->fetch_row($ggq); $event=str_replace("'","''","[url='gangs.php?action=view&ID={$ir[']{$gangdata['gangNAME']}[/url] have accepted the surrender from [url='gangs.php?action=view&ID={$them[']{$them['gangNAME']}[/url], the war is over!"); $db->query("INSERT INTO gangevents VALUES('',{$ir['gang']},unix_timestamp(),'$event') , ('',".$r[$f].",unix_timestamp(),'$event')"); print "You have accepted surrender, the war is over."; } Quote Link to comment Share on other sites More sharing options...
thedestroyer Posted August 8, 2009 Share Posted August 8, 2009 Re: Gang Surrender replace it with this if it is v2 function gang_staff_viewsurrenders() { global $db,$ir,$c,$userid,$gangdata; if(!isset($_POST['subm'])) { echo "<form action='yourgang.php?action=staff&act2=viewsurrenders' method='post'> Choose who to accept the surrender from. <input type='hidden' name='subm' value='submit' /> Gang: <select name='sur' type='dropdown'>"; $sql = sprintf( "SELECT s.*, w.* " . "FROM surrenders s " . "LEFT JOIN gangwars w ON (s.surWAR = w.warID) " . "WHERE (surTO = %u)", $ir['gang']); $wq = $db->query($sql); while($r = $db->fetch_row($wq)) { $w = ($gangdata['gangID'] == $r['warDECLARER']) ? "You" : "Them"; $f = ($gangdata['gangID'] == $r['warDECLARER']) ? "warDECLARED" : "warDECLARER"; $SelectGangs = sprintf("SELECT * FROM gangs WHERE (gangID = %u)", $r[$f]); $ggq = $db->query($SelectGangs); $them = $db->fetch_row($ggq); echo sprintf("<option value='%u'>War vs. %s (Msg: %s)</option>", $r['surID'], stripslashes($them['gangNAME']), stripslashes($r['surMSG'])); } echo "</select> <input type='submit' value='Accept Surrender' /></form>"; } else { $_POST['sur'] = abs(@intval($_POST['sur'])); $SelectWar = sprintf("SELECT surWAR FROM surrenders WHERE (surID = %u)", $_POST['sur']); $q = $db->query($SelectWar); if(!$db->num_rows($q)) { echo "Invalid surrender"; $h->endpage(); exit; } $war = $db->fetch_row($q); $SelectGangWars = sprintf("SELECT * FROM gangwars WHERE (warID = %u)", $war['surWAR']); $wq = $db->query($SelectGangWars); if($db->num_rows($wq) == 0) { echo "Invalid Gang"; exit; } $r = $db->fetch_row($wq); $w = ($gangdata['gangID'] == $r['warDECLARER']) ? "You" : "Them"; $f = ($gangdata['gangID'] == $r['warDECLARER']) ? "warDECLARED" : "warDECLARER"; $AcceptSurrender = sprintf("DELETE FROM surrenders WHERE (surID = %u)", $_POST['sur']); $EndWar = sprintf("DELETE FROM gangwars WHERE (warID = %u)", $war['surWAR']); $db->query($AcceptSurrender); $db->query($EndWar); $SelectGang = sprintf("SELECT gangID, gangNAME FROM gangs WHERE (gangID = %u)", $r[$f]); $ggq = $db->query($SelectGang); $them = $db->fetch_row($ggq); $eventage = sprintf("[url='gangs.php?action=view&ID=%u']%s[/url] have accepted the surrender from [url='gangs.php?action=view&ID=%u']%s[/url]. The war is over!", $ir['gang'], $gangdata['gangNAME'], $them['gangID'], $them['gangNAME']); $event = str_replace("'", "''", $eventage); $LogEvent = sprintf("INSERT INTO gangevents VALUES ('', %u, unix_timestamp(), '%s'), ('', %u, unix_timestamp(), '%s')", $ir['gang'], $event, $r[$f], $event); $db->query($LogEvent); echo "You have accepted surrender, the war is over."; Quote Link to comment Share on other sites More sharing options...
Strats Posted August 8, 2009 Share Posted August 8, 2009 Re: Gang Surrender Please stop posting questions here This section is for mods Quote Link to comment Share on other sites More sharing options...
Cod Phoenix Posted August 8, 2009 Share Posted August 8, 2009 Re: Gang Surrender Please stop posting questions here This section is for mods Yes, it proper annoying cause people thinks it's a mod but its not. Quote Link to comment Share on other sites More sharing options...
thedestroyer Posted August 8, 2009 Share Posted August 8, 2009 Re: Gang Surrender Please stop posting questions here This section is for mods Yes, it proper annoying cause people thinks it's a mod but its not. I helped him now anyway lol Quote Link to comment Share on other sites More sharing options...
benlakaz Posted August 9, 2009 Author Share Posted August 9, 2009 Re: Gang Surrender thanks thedestroyer.. +1 for you Quote Link to comment 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.