Jump to content

[SOLVED] my array wont work :(


sandrob57

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.