radio_active Posted August 28, 2008 Share Posted August 28, 2008 Re: Gang surrender accept, SQL error. No, our problem we think is to do with Gang Pictures which has somehow screwed up our surrender, that script does not work, their is still the same error! Thanks anyway killah. Quote Link to comment Share on other sites More sharing options...
03laceys Posted August 28, 2008 Author Share Posted August 28, 2008 Re: Gang surrender accept, SQL error. I completly uploaded all original gang files and sql's and i still got the error managed to fix it though. try doing what i done it help me. Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted August 28, 2008 Share Posted August 28, 2008 Re: Gang surrender accept, SQL error. I fixed mine the way i said and now my gang file's work. Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted August 29, 2008 Share Posted August 29, 2008 Re: Gang surrender accept, SQL error. that shouldn't work kyle maybe read the code iight $q=$db->query("SELECT surWAR FROM surrenders WHERE surID={$_POST['sur']}"); list($_POST['war']) = $db->fetch_row($q); means that $_POST['war'] = surWAR i mean come on... Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted August 29, 2008 Share Posted August 29, 2008 Re: Gang surrender accept, SQL error. Well mine works now. Quote Link to comment Share on other sites More sharing options...
radio_active Posted September 1, 2008 Share Posted September 1, 2008 Re: Gang surrender accept, SQL error. Interesting, i manually started a war in the DB then manually made a surrender in the DB and accepted it and it worked... then i got a gang to declare and surrender and suprisingly enough, it didnt work...Im moved the code around so the "Delete from gangwars was at the top and the delete for surrenders was at the bottom so i could keep on testing it without having to send a new Surrender every time.... I then got a gang to declare war then made a surrender and also an error... So this leads me to think that the error is in either declare war function or the surrender function...Any ideas? Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 1, 2008 Share Posted September 1, 2008 Re: Gang surrender accept, SQL error. Best replace your surrender view function with my one :) Quote Link to comment Share on other sites More sharing options...
radio_active Posted September 1, 2008 Share Posted September 1, 2008 Re: Gang surrender accept, SQL error. I have your accept_surrender function in.... you surrender_function did not work, had errors in it! Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 1, 2008 Share Posted September 1, 2008 Re: Gang surrender accept, SQL error. mine works Quote Link to comment Share on other sites More sharing options...
radio_active Posted September 1, 2008 Share Posted September 1, 2008 Re: Gang surrender accept, SQL error. mine works First error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/dtoorg/public_html/yourgang.php on line 842 which is if($gangdata['gangID'] == $r['warDECLARER']) using this code function gang_staff_surrender() { global $db,$ir,$c,$userid,$gangdata; if(!isset($_POST['subm'])) { echo '<form action="yourgang.php?action=staff&act2=surrender" method="post"> Choose who to surrender to.[b] <input type="hidden" name="subm" value="submit"> Gang: <select type="dropdown" name="war">'; $wq = $db->query("SELECT * FROM gangwars where warDECLARER=".$ir['gang']." or warDECLARED=".$ir['gang']); while($r = $db->_fetch_row($wq)) { if($gangdata['gangID'] == $r['warDECLARER']) { $w = "You"; $f = "warDECLARED"; } else { $w = "Them"; $f = "warDECLARER"; } $d = date('F j, Y, g:i:s a',$r['warTIME']); $ggq = $db->query("SELECT * FROM gangs WHERE gangID=".$r['$f']); $them = $db->fetch_assoc($ggq); echo '<option value="'.$r['warID'].'" name="war">'.$them['gangNAME'].'</option>'; } echo '</select> Message: <input type="text" name="msg"> <input type="submit" value="Surrender"></form>'; } else { $_POST['war'] = abs(@intval($_POST['war'])); $wq = $db->query("SELECT * FROM gangwars where warID=".$_POST['war'].") or die(mysql_error()); $r = $db->fetch_row($wq); if($gangdata['gangID'] == {$r['warDECLARER']}) { $w = "You"; $f = "warDECLARED"; } else { $w = "Them"; $f = "warDECLARER"; } $db->query("INSERT INTO surrenders VALUES(NULL,".$_POST['war'].",".$ir['gang'].",".$r[$f].",'".$_POST['msg']."')") or die(mysql_error()); $ggq = $db->query("SELECT * FROM gangs WHERE gangID=".$r['$f']) or die(mysql_error()); $them = $db->fetch_row($ggq); $event = str_replace("'","''","[url='gangs.php?action=view&ID=".$ir[']".$gangdata['gangNAME']."[/url] have asked to surrender the war against [url='gangs.php?action=view&ID=".$them[']".$them['gangNAME']."[/url]"); $db->query("INSERT INTO gangevents VALUES('',".$ir['gang'].",unix_timestamp(),'".$event."') , ('',".$r['$f'].",unix_timestamp(),'".$event."')") or die(mysql_error()); echo 'You have asked to surrender'; } } Which is just the mysql querys changed to $db->querys! Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 1, 2008 Share Posted September 1, 2008 Re: Gang surrender accept, SQL error. You replaced the wrong code! my function is: function gang_staff_viewsurrenders() Your replacing or trying to fix: function gang_staff_surrender() Quote Link to comment Share on other sites More sharing options...
radio_active Posted September 1, 2008 Share Posted September 1, 2008 Re: Gang surrender accept, SQL error. function gang_staff_surrender() { global $db,$ir,$c,$userid,$gangdata; if(!isset($_POST['subm'])) { echo '<form action="yourgang.php?action=staff&act2=surrender" method="post"> Choose who to surrender to.[b] <input type="hidden" name="subm" value="submit"> Gang: <select type="dropdown" name="war">'; $wq = $db->query("SELECT * FROM gangwars where warDECLARER=".$ir['gang']." or warDECLARED=".$ir['gang']); while($r = $db->_fetch_row($wq)) { if($gangdata['gangID'] == $r['warDECLARER']) { $w = "You"; $f = "warDECLARED"; } else { $w = "Them"; $f = "warDECLARER"; } $d = date('F j, Y, g:i:s a',$r['warTIME']); $ggq = $db->query("SELECT * FROM gangs WHERE gangID=".$r['$f']); $them = $db->fetch_assoc($ggq); echo '<option value="'.$r['warID'].'" name="war">'.$them['gangNAME'].'</option>'; } echo '</select> Message: <input type="text" name="msg"> <input type="submit" value="Surrender"></form>'; } else { $_POST['war'] = abs(@intval($_POST['war'])); $wq = $db->query("SELECT * FROM gangwars where warID=".$_POST['war'].") or die(mysql_error()); $r = $db->fetch_row($wq); if($gangdata['gangID'] == {$r['warDECLARER']}) { $w = "You"; $f = "warDECLARED"; } else { $w = "Them"; $f = "warDECLARER"; } $db->query("INSERT INTO surrenders VALUES(NULL,".$_POST['war'].",".$ir['gang'].",".$r[$f].",'".$_POST['msg']."')") or die(mysql_error()); $ggq = $db->query("SELECT * FROM gangs WHERE gangID=".$r['$f']) or die(mysql_error()); $them = $db->fetch_row($ggq); $event = str_replace("'","''","[url='gangs.php?action=view&ID=".$ir[']".$gangdata['gangNAME']."[/url] have asked to surrender the war against [url='gangs.php?action=view&ID=".$them[']".$them['gangNAME']."[/url]"); $db->query("INSERT INTO gangevents VALUES('',".$ir['gang'].",unix_timestamp(),'".$event."') , ('',".$r['$f'].",unix_timestamp(),'".$event."')") or die(mysql_error()); echo 'You have asked to surrender'; } } 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['sur']}"); $r=$db->fetch_row($wq); if($gangdata['gangID'] == $r['warDECLARER']) { $w="You"; $f="warDECLARED"; } else { $w="Them"; $f="warDECLARER"; } $db->query("DELETE FROM gangwars WHERE warID={$_POST['sur']}"); $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!"); $ggq=$db->query("SELECT * FROM gangs WHERE gangID=".$r[$f]); $them=$db->fetch_row($ggq); $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."; $db->query("DELETE FROM surrenders WHERE surID={$_POST['sur']}"); } } Actually tried both of your posts! Quote Link to comment Share on other sites More sharing options...
radio_active Posted September 1, 2008 Share Posted September 1, 2008 Re: Gang surrender accept, SQL error. FInd in the accept surrender function list($_POST['war']) = $db->fetch_row($q); replace with: $_POST['war'] = $db->fetch_single($q); And walah, it works! Fixed it Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 1, 2008 Share Posted September 1, 2008 Re: Gang surrender accept, SQL error. Well the way i did it works for my game. Quote Link to comment Share on other sites More sharing options...
radio_active Posted September 1, 2008 Share Posted September 1, 2008 Re: Gang surrender accept, SQL error. Congradulations, you have told us that like 4 times now! Quote Link to comment Share on other sites More sharing options...
secret_life Posted April 7, 2013 Share Posted April 7, 2013 Ok just do it simple. I post for who have never find good anwser in post Replace $_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("'","''","<a href='gangs.php?action=view&ID={$ir['gang']}'>{$gangdata['gangNAME']}</a> have accepted the surrender from <a href='gangs.php?action=view&ID={$them['gangID']}'>{$them['gangNAME']}</a>, the war is over!"); $db->query("INSERT INTO gangevents VALUES('',{$ir['gang']},unix_timestamp(),'$event') , ('',".$r[$f].",unix_timestamp(),'$event')"); echo "You have accepted surrender, the war is over."; By this $_POST['sur'] = abs((int) $_POST['sur']); $q=$db->query("SELECT surWAR FROM surrenders WHERE surID={$_POST['sur']}"); $warfetch = $db->fetch_row($q); $wq=$db->query("SELECT * FROM gangwars where warID={$warfetch['surWAR']}"); $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={$warfetch['surWAR']}"); $ggq=$db->query("SELECT * FROM gangs WHERE gangID=".$r[$f]); $them=$db->fetch_row($ggq); $event=str_replace("'","''","<a href='gangs.php?action=view&ID={$ir['gang']}'>{$gangdata['gangNAME']}</a> have accepted the surrender from <a href='gangs.php?action=view&ID={$them['gangID']}'>{$them['gangNAME']}</a>, the war is over!"); $db->query("INSERT INTO gangevents VALUES('',{$ir['gang']},unix_timestamp(),'$event') , ('',".$r[$f].",unix_timestamp(),'$event')"); echo "You have accepted surrender, the war is over."; Have good day now :) 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.