Page 1 of 1
elseif
Posted: Mon Jul 27, 2009 5:18 am
by cronika
Code: Select all
$sql = mysql_query("SELECT xp FROM users")or die(mysql_error());
while($row = mysql_fetch_array($sql))
{
if($row['xp'] <= 50 )
{
echo "level 1";
}
elseif ($row['xp'] => 51 )
{
echo "lev 2";
}
}
The error i got is :
Parse error: parse error in C:\xampp\htdocs\Joc_xampp\level.php on line 10 Why?
Re: elseif
Posted: Mon Jul 27, 2009 5:34 am
by VladSun
Re: elseif
Posted: Mon Jul 27, 2009 5:54 am
by cronika
i manage to do it. thank you
But now the browser show me 2 level "lev 2level 1" why?
Re: elseif
Posted: Mon Jul 27, 2009 6:03 am
by Mark Baker
Greater than or equal is >= not =>
Re: elseif
Posted: Mon Jul 27, 2009 8:59 am
by MeLight
Wow, didn't even know that's the right syntax. Been using "else if" from the beginning
