sandrob57 Posted February 28, 2007 Share Posted February 28, 2007 it only shows everything once, even though there are two rows in the database where a_id = 1. //check if in a war $result = dbcount("(a_id)", "wars", "a_id='".$userdata['user_id']."'"); if ($result != 0){ $offensive = true; }else { $offensive = false; } $result = dbcount("(d_id)", "wars", "d_id='".$userdata['user_id']."'"); if ($result != 0){ $defensive = true; }else { $defensive = false; } //check done, now show them some shit if ($offensive == false){ echo "<center><br /><br /> <i>You are not in an Offensive War.</i> <br /><br /><br /></center>"; }elseif ($offensive == true){ $result = dbquery("SELECT * FROM fusion_wars WHERE a_id='".$userdata['user_id']."'"); while ($data = dbarray($result)){ $result = dbquery("SELECT * FROM fusion_users WHERE user_id='".$data['d_id']."'"); if (dbrows($result)) { $target = dbarray($result); } else { redirect("index.php"); } echo "<br /><br /><center><font size=2><b>You are at war with <a href=".BASEDIR."profile.php?lookup=".$target['user_id'].">".$target['c_name']."</a>! </b></font></center><br /><br />"; echo "<center>This war started ".showdate("%m/%d/%Y at %H:%M", $data['war_start']).".<br /> It will end ".showdate("%m/%d/%Y at %H:%M", $a_end)."</center>"; if ($data['a_turns'] > 0){ echo "<center>At this time, you may make up to <b>".$data['a_turns']."</b> moves.</center>"; tablebreak(); tablebreak(); echo "<center><form name='inputform' method='post' action='".BASEDIR."viewpage.php?page_id=21&view=ground&type=o' enctype='multipart/form-data'><input type='submit' name='war' value='Launch Ground Attack' class='button' STYLE='width: 150px;'></form></center> <center><form name='inputform' method='post' action='".BASEDIR."viewpage.php?page_id=21&view=air&type=o' enctype='multipart/form-data'><input type='submit' name='war' value='Launch Orbital Attack' class='button' STYLE='width: 150px;'></form></center> <center><form name='inputform' method='post' action='".BASEDIR."viewpage.php?page_id=21&view=missile&type=o' enctype='multipart/form-data'><input type='submit' name='war' value='Launch Missile Attack' class='button' STYLE='width: 150px;'></form></center>"; }else{ echo "<br /><center><img src=".IMAGES."/alert.jpg> You do not have any turns left now.<br />You gain 2 turns every 12 hours.</center>"; } echo "<br /><center><form name='inputform' method='post' action='".BASEDIR."wars/peace_change.php?declare=a' enctype='multipart/form-data'><input type='submit' name='war' value='Declare Peace' class='button' STYLE='width: 150px;'></form></center>"; } } Link to comment https://forums.phpfreaks.com/topic/40451-solved-my-array-wont-work/ Share on other sites More sharing options...
btherl Posted February 28, 2007 Share Posted February 28, 2007 You're using $result for both the inner and outer query. Use different variable names and you should be fine Link to comment https://forums.phpfreaks.com/topic/40451-solved-my-array-wont-work/#findComment-195735 Share on other sites More sharing options...
sandrob57 Posted February 28, 2007 Author Share Posted February 28, 2007 You're using $result for both the inner and outer query. Use different variable names and you should be fine works, thanks. Link to comment https://forums.phpfreaks.com/topic/40451-solved-my-array-wont-work/#findComment-195739 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.