elseif

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

Post Reply
cronika
Forum Commoner
Posts: 27
Joined: Sun Jul 26, 2009 2:28 pm
Location: romania
Contact:

elseif

Post 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?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: elseif

Post by VladSun »

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:

Re: elseif

Post by cronika »

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

Re: elseif

Post by Mark Baker »

Greater than or equal is >= not =>
MeLight
Forum Commoner
Posts: 26
Joined: Sun Apr 19, 2009 12:39 pm
Location: Israel

Re: elseif

Post by MeLight »

Wow, didn't even know that's the right syntax. Been using "else if" from the beginning :D
Post Reply