fagan Posted March 18, 2007 Share Posted March 18, 2007 Hello i am just wondering does anyone no how to fix his error when i try to accept a surrender it says 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= could anyone plz help write back here plz Quote Link to comment Share on other sites More sharing options...
Vorlen Posted March 18, 2007 Share Posted March 18, 2007 Re: Gang war surrender error Put the code here that is messing up. :) Quote Link to comment Share on other sites More sharing options...
fagan Posted March 18, 2007 Author Share Posted March 18, 2007 Re: Gang war surrender error <?php include "globals.php"; print "<h3> Gang Wars</h3> <table width=75% cellspacing=1 class='table'>"; $q=$db->query("SELECT w.*,g1.gangNAME as declarer, g1.gangRESPECT as drespect, g2.gangNAME as defender, g2.gangRESPECT as frespect FROM gangwars w LEFT JOIN gangs g1 ON w.warDECLARER=g1.gangID LEFT JOIN gangs g2 ON w.warDECLARED=g2.gangID WHERE g1.gangNAME != '' AND g2.gangNAME != ''"); if($db->num_rows($q) > 0) { while($r=$db->fetch_row($q)) { print "<tr> <td width=45%>{$r['declarer']} [{$r['drespect']} respect]</a></td> <td width=10%>vs.</td> <td width=45%>{$r['defender']} [{$r['frespect']} respect]</a></td> </tr>"; } } else { print "</table>There are currently no gang wars in progress."; } print "</table>"; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Vorlen Posted March 18, 2007 Share Posted March 18, 2007 Re: Gang war surrender error That shows the gang wars themselves, nothing to do with surrendering.... I think you meant the part in yourgang.php gang_staff_surrender.... Here it is. function gang_staff_surrender() { global $db,$ir,$c,$userid,$gangdata; if(!isset($_POST['subm'])) { print "<form action='yourgang.php?action=staff&act2=surrender' method='post'> Choose who to surrender to. <input type='hidden' name='subm' value='submit' /> Gang: <select name='war' type='dropdown'>"; $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_row($ggq); print "<option value='{$r['warID']}'>{$them['gangNAME']}</option>"; } print "</select> Message: <input type='text' name='msg' /> <input type='submit' value='Surrender' /></form>"; } else { $_POST['war'] = abs((int) $_POST['war']); $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("INSERT INTO surrenders VALUES('',{$_POST['war']},{$ir['gang']},".$r[$f].",'{$_POST['msg']}')"); $ggq=$db->query("SELECT * FROM gangs WHERE gangID=".$r[$f]); $them=$db->fetch_row($ggq); $event=str_replace("'","''","{$gangdata['gangNAME']} have asked to surrender the war against {$them['gangNAME']}"); $db->query("INSERT INTO gangevents VALUES('',{$ir['gang']},unix_timestamp(),'$event') , ('',".$r[$f].",unix_timestamp(),'$event')"); print "You have asked to surrender."; } } If that doesn't work, that PROBABLY means you didn't input all the SQL properly. Quote Link to comment Share on other sites More sharing options...
fagan Posted March 18, 2007 Author Share Posted March 18, 2007 Re: Gang war surrender error Now i have done that its saying Fatal error: Call to undefined function: gang_staff_viewsurrenders() in /home/nwc/public_html/yourgang.php on line 397 Quote Link to comment Share on other sites More sharing options...
Vorlen Posted March 18, 2007 Share Posted March 18, 2007 Re: Gang war surrender error Look, you MUST have edited the code, MUST have. Go into your original codes thing, and take that page. You got the codes from Dabs, so in there you will find yourgang.php which will work fine. Quote Link to comment Share on other sites More sharing options...
fagan Posted March 18, 2007 Author Share Posted March 18, 2007 Re: Gang war surrender error it is the original code i aint touched it Quote Link to comment Share on other sites More sharing options...
Vorlen Posted March 18, 2007 Share Posted March 18, 2007 Re: Gang war surrender error You must have. Either that or you did something wrong in the database. Put the original in and tell me what error it gives you. Quote Link to comment Share on other sites More sharing options...
seanybob Posted April 11, 2007 Share Posted April 11, 2007 Re: Gang war surrender error vorlen this is actually a real problem... i get the same error as well with untouched scripts. anyone know what the fix is? Quote Link to comment Share on other sites More sharing options...
Vorlen Posted April 11, 2007 Share Posted April 11, 2007 Re: Gang war surrender error vorlen this is actually a real problem... i get the same error as well with untouched scripts. anyone know what the fix is? Sorry haha, just I've never seen that problem, even in V2... I'll check mine. Quote Link to comment Share on other sites More sharing options...
seanybob Posted April 25, 2007 Share Posted April 25, 2007 Re: Gang war surrender error anyone find the fix for this yet? Quote Link to comment Share on other sites More sharing options...
chaoswar4u Posted April 26, 2007 Share Posted April 26, 2007 Re: Gang war surrender error The error came also as standard in my V2 code. The error if the same as mine is 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= The fix is 1 - open yourgang.php 2 - find: list($_POST['war']) = $db->fetch_row($q); 3 - replace: $_POST['war'] = $db->fetch_single($q); Should solve your problem. :-P Quote Link to comment Share on other sites More sharing options...
whitescout Posted August 21, 2007 Share Posted August 21, 2007 Re: Gang war surrender error If anyone has this problem still, I would reccomend going into your database, and checking your surrender logs. I cleared out all of my surrenders, as there were some multiple surrenders, and surrenders for gangs that had no members. I do not know which fixed it, but the surrender works now. Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted November 18, 2007 Share Posted November 18, 2007 Re: Gang war surrender error what unction is that under Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted March 16, 2008 Share Posted March 16, 2008 Re: Gang war surrender error Thank you that was doing my head in trying to work it out :) Quote Link to comment Share on other sites More sharing options...
mr_shuu Posted January 24, 2011 Share Posted January 24, 2011 Dabs could do updates on these things... realllly! Have I told you guys how much I think I love you? That problem was driving me crazy... 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.