Page 1 of 1
					
				help with php coding
				Posted: Sun Feb 05, 2012 11:25 pm
				by Henning12342
				hi guys im having a problem i am trying to one make a unequip link [SOLVED]
ERROR messages [SOLVED]
now im tryng to get it to add values eg.
ship base attack = 100
weapon base attack = 100
ship base attack + weapon base attack = new ship attack
new ship attack - weapon base attack = old ship attack
any ideas would be great
and thanks in advance
			 
			
					
				Re: help with php coding
				Posted: Mon Feb 06, 2012 6:58 pm
				by SpiritWebb
				Code: Select all
or die("could not get player stats!");
Put mysql_error() with those as well, to find out the full error.
Code: Select all
or die("could not get player stats!" . mysql_error());
EDIT:
Also, place the following at the top of your scripts, this should help as well.
 
			
					
				Re: help with php coding
				Posted: Wed Feb 08, 2012 7:10 pm
				by Henning12342
				right i have this code but dont know where to put it ill post my shipequipped.php and shipunequipped.php code as well
                Code: Select all
$shipBaseAttk = 100;
		$weaponBaseAttk = 100;
		$shipAttack = $shipBaseAttk + $weaponBaseAttk;
		$oldShipAttack = $shipAttack - $weaponBaseAttk;
shipequipped.php
Code: Select all
<?php
include_once 'connect.php';
 session_start();
   include_once 'logo.php';
   ?>
     <link href="style.css" rel="stylesheet" type="text/css" />
<?php
{	
	if (isset($_SESSION['player']))
	  $player=$_SESSION['player'];
	
	else
	{
	  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
	  exit;
	}
	$playerinfo="SELECT * from players where name='$player'";
	$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
	$playerinfo3=mysql_fetch_array($playerinfo2);
	include_once 'statpanel.php';
	$id=$playerinfo3['id'];
	
}
?>
</div>
<div id="table">
 <?php
		$type=$_GET['type'];
		$randid=$_GET['randid'];
		
	   if ($type=="w")
	   {
	 $updateequip="Update playerships SET equip=0 WHERE pid='$id' AND equip=1";
	    mysql_query($updateequip) or die("Could not update equipment");	
		 $reequip="Update playerships set equip=1 where pid='$id' AND randid='$randid'";
	    mysql_query($reequip) or die("Could not update equipment2");	
		echo "<center><big><big>Got In To Ship<br></big></big>";
		echo "<br><A href='index.php'>Go back</a>";
		}
		
	
	
		
  
  ?>
</div>
<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'></a>";
?>
</div>
shipunequiped.php
Code: Select all
<?php
include_once 'connect.php';
 session_start();
   include_once 'logo.php';
   ?>
     <link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
$id=$playerinfo3['id'];
?>
</div>
<div id="table">
 <?php
	    $type=$_GET['type'];
		$randid=$_GET['randid'];
	  
	   if ($type=="w")
	   {
	 $updateequip="Update playerships SET equip=0 WHERE pid='$id' AND equip=0";
	    mysql_query($updateequip) or die("Could not update equipment");	
		 $reequip="Update playerships set equip=0 where pid='$id' AND randid='$randid'";
	    mysql_query($reequip) or die("Could not update equipment2");	
		
		echo "<center><big><big>Got Out Of Ship<br></big></big>";
		echo "<br><A href='index.php'>Go back</a>";
		}
		
  
  ?>
</div>
<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'></a>";
?>
</div>