Tonka Posted June 28, 2008 Share Posted June 28, 2008 My view surrenders is not working and i'm not sure why, everything looks fine to me 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' style='background-color: #000000; color:#FFFFFF;'>"; $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' style='background-color: #000000; color:#FFFFFF;' /></form>"; } else { $_POST['sur'] = abs((int) $_POST['sur']); $q=$db->query("SELECT surWAR FROM surrenders WHERE surID={$_POST['sur']}"); $_POST['war'] = $db->fetch_single($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...
Floydian Posted June 28, 2008 Share Posted June 28, 2008 Re: View Surrenders what about it is not working? are you getting errors? is the page displaying at all, or are you getting the white page of death? if the page is displaying, what isn't displaying the should be? Quote Link to comment Share on other sites More sharing options...
Tonka Posted June 28, 2008 Author Share Posted June 28, 2008 Re: View Surrenders the page works, it's just not displaying any surrenders and it's not exiting at the end of the function Quote Link to comment Share on other sites More sharing options...
Floydian Posted June 28, 2008 Share Posted June 28, 2008 Re: View Surrenders so nothing is printed to the screen at all eh? looking at the code, no matter what you throw at that function, ie, in terms of a $_POST['subm'] variable, it will print something, which leads me to believe that the function is not getting called at all. Quote Link to comment Share on other sites More sharing options...
Tonka Posted June 28, 2008 Author Share Posted June 28, 2008 Re: View Surrenders its displaying the drop down and that's it, Quote Link to comment Share on other sites More sharing options...
Floydian Posted June 28, 2008 Share Posted June 28, 2008 Re: View Surrenders In this situation, I would load up that page, then click on "view source" and look at the html that was output by the script. Since the submit button isn't being shown, it would seem that there's an error somewhere in the while loop. If php is outputting an error message, and that error message is getting inserted into the select drop down menu, that could cause the html error you're seeing. It's also possible that if gangs on your game are allowed to put special symbols like < > ' " into their gang names, that could be what's causing the html error there, and again, the view source on the html should show what that error is. Go ahead and check that out, and post the source html here if you don't see anything yourself so I can take a look at it. From what I can tell, I'm pretty sure there's an html error coming in here. Another thing you can do, is take a query like $ggq=$db->query("SELECT * FROM gangs WHERE gangID=".$r[$f]); and run it in php my admin. You can also try to echo the $r[$f] variable as well so that you can see what value it contains. Keep in mind, that this query is done in the middle of a select html element, so you will want to comment out the echo's that output the select, and that will allow you to echo this value to the screen. If that $r[$f] variable doesn't come out with a number, then that is definitely the reason why the html is getting errors. Try that stuff out and let me know what happens. Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted July 7, 2008 Share Posted July 7, 2008 Re: View Surrenders try this im not sure but seems like you changed alot in there.. else { $_POST['sur'] = abs((int) $_POST['sur']); $q=$db->query("SELECT surWAR FROM surrenders WHERE surID={$_POST['sur']}"); $_POST['war'] = $db->fetch_single($q); $wq=$db->query("SELECT * FROM gangwars where warID={$_POST['war']}"); $r=$db->fetch_row($wq); to 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); Quote Link to comment Share on other sites More sharing options...
Tonka Posted July 7, 2008 Author Share Posted July 7, 2008 Re: View Surrenders it didn't work, it's only happening to gang 1, which is my test gang Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted July 8, 2008 Share Posted July 8, 2008 Re: View Surrenders CHeck your database see if the surrender is still there...Maybe it didnt send or got deleted somehow.... Let us know i will keep trying to help :P Quote Link to comment Share on other sites More sharing options...
Tonka Posted July 8, 2008 Author Share Posted July 8, 2008 Re: View Surrenders all the other gangs work fine, it's just my gang, so it doesn't matter to much Quote Link to comment Share on other sites More sharing options...
War_Hero Posted July 30, 2008 Share Posted July 30, 2008 Re: View Surrenders My brother had this problem on our game. But our problem was that the table still had uncompleted surrenders there. We had a full game reset and deleted everything but items and crimes, but forgot to truncate the surrenders table, so that was causing the problem. But now, it's all good. =] 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.