...

View Full Version : Level/If/Else Help



NightFlyer
05-13-2008, 12:42 AM
Hey. I've had a problem like this before but I forgot how I solved it. Anyways here's what I have:


<?php require_once("include/database.php"); ?>
<?php $result = mysql_query("SELECT * FROM users WHERE username = '$level'")
or die(mysql_error()); ?>

<?php





$level = $retreive_from_database;
if($level > 13) {

echo "13";
$level = $retreive_from_database;
if($level > 12) {

echo "12";
}
}
$level = $retreive_from_database;
if($level > 11) {

echo "11";

}
if ($level != 10) {

echo "10";

}
?>

I'm trying to make it where if the level is "10" it will echo "10" if it's "11" it'll echo "11" and so on.

But it's always echoing "10"

How can I solve this issue?

Thanks :D

Mwnciau
05-13-2008, 01:18 AM
Have a look at your logic again:


$level = $retreive_from_database;
if($level > 13) // If level is greater than 13
{
echo "13";
$level = $retreive_from_database; // same as $level = $level;

if($level > 12) // If level is greater than 13
{
echo "12";
}
}

$level = $retreive_from_database; // same as $level = $level;

if($level > 11) // If level is greater than 11
{
echo "11";
}

if ($level != 10) // If level is NOT 10
{
echo "10";
}

P.S. couldn't you just echo $retreive_from_database?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum