the ehp is the computers hp and the hp is the hp of the person
i am trying to make the counter go up by 1 when the counter - 1
thats what the first bit is doing if the counter is over 1 then it will take 10 of hp
and put it back to 1 hope every 1 knows what im trying to do
<?php
$sql = "SELECT counter from battle WHERE username='".$_SESSION['username']."'";
$res = mysql_query($sql) or die('Invalid query: ' . mysql_error());
$val = mysql_fetch_array($res);
echo $_SESSION['counter'];
echo $val['curhp'];
if (isset($_POST['submit'])) {
if ($_SESSION['counter'] = 1) {
$sql="UPDATE `battle` SET `ehp`=`ehp`-10 WHERE `username` = '" . $_SESSION['username'] . "'";
$result=mysql_query($sql);
echo "step 1";
}else{
$sql="UPDATE `battle` SET `hp`=`hp`-10 WHERE `username` = '" . $_SESSION['username'] . "'";
$result=mysql_query($sql);
echo "step 2";
}
$_SESSION['counter'] = 1;
}
$_SESSION['counter'] = 1;
?>
any idea's why its taking it off ehp but not hp

New Topic/Question
Reply


MultiQuote




|