Jump to content
MakeWebGames

Gang war surrender error


fagan
 Share

Recommended Posts

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

Link to comment
Share on other sites

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();

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

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

Link to comment
Share on other sites

  • 3 months later...

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.

Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...
  • 2 years later...

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.

 Share

×
×
  • Create New...