Error in conditional statement

I’m doing this:

mysql_query("SELECT * FROM startpoke WHERE id_poke='".$_SESSION['id']."'");
if(life > 0 ){
$res = mysql_query("UPDATE `startpoke` SET `life`=`life`-3 WHERE id_poke='".$_SESSION['id']."'")or die(mysql_error()) ;
}
else
{
echo "";
}

I have lifegreater than zero and it gives me “be”. Tell me, please, what to do?


Answer 1, authority 100%

Learn the basics.

$sql=mysql_query("SELECT * FROM startpoke WHERE id_poke='".$_SESSION['id']."'");
$row=mysql_fetch_array($sql);
if($row['life'] > 0 ){
$res = mysql_query("UPDATE `startpoke` SET `life`=`life`-3 WHERE id_poke='".$_SESSION['id']."'")or die(mysql_error()) ;
}
else
{
echo "";
}

Answer 2

Not life, but $life.