PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
cronika
Forum Commoner
Posts: 27 Joined: Sun Jul 26, 2009 2:28 pm
Location: romania
Contact:
Post
by cronika » Mon Jul 27, 2009 5:18 am
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?
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Mon Jul 27, 2009 5:34 am
There are 10 types of people in this world, those who understand binary and those who don't
cronika
Forum Commoner
Posts: 27 Joined: Sun Jul 26, 2009 2:28 pm
Location: romania
Contact:
Post
by cronika » Mon Jul 27, 2009 5:54 am
i manage to do it. thank you
But now the browser show me 2 level "lev 2level 1" why?
Mark Baker
Forum Regular
Posts: 710 Joined: Thu Oct 30, 2008 6:24 pm
Post
by Mark Baker » Mon Jul 27, 2009 6:03 am
Greater than or equal is >= not =>
MeLight
Forum Commoner
Posts: 26 Joined: Sun Apr 19, 2009 12:39 pm
Location: Israel
Post
by MeLight » Mon Jul 27, 2009 8:59 am
Wow, didn't even know that's the right syntax. Been using "else if" from the beginning