Jump to content

Odd if statement problems...


ChambeRFienD

Recommended Posts

[code]
case 'admin':
                echo $user_level;
                if($user_level == 1) {
                    echo "<h3>Administrative Alt Edit</h3>";
                    if(isset($_GET['f'])) {
                    $alt_id = $_GET['alt'];
                    $sql_check = mysql_query("SELECT * FROM alts_trade WHERE trade_id='$alt_id'");
                    $row_check = mysql_fetch_array($sql_check);
                    $alt_name = $row_check['trade_name'];
                    if($user_level == 1) {
                        mysql_query("DELETE FROM alts_trade WHERE trade_id='$alt_id'");
                        echo "<strong>$alt_name was deleted from the database!</strong>";
                    } else {
                        echo "<strong>You cannot delete alts from other people's lists!</strong>";
                    }
                    $trade_id = $_GET['alt'];
                    $sql_info = mysql_query("SELECT * FROM alts_trade WHERE trade_id='$trade_id'");
                    $row_info = mysql_fetch_array($sql_info);
                    $comments1 = $row_info['trade_comments'];
                    $name1 = $row_info['trade_name'];
                    $level1 = $row_info['trade_level'];
                    if($user_level != 1) {
                        echo "$user_level<br />There's no way you're supposed to be here.. Tisk tisk.";
                    } else {
                        if(isset($_POST['edited'])) {
                            $alt_id = $_POST['edited'];
                            $comments = mysql_real_escape_string($_POST['comments']);
                            $name = mysql_real_escape_string($_POST['name']);
                            $level = $_POST['level'];
                            mysql_query("UPDATE alts_trade SET trade_name='$name', trade_comments='$comments', trade_level='$level' WHERE trade_id='$alt_id'") or die(mysql_error());
                            echo "<b>Alt Edited</b><br />
                            <font size='-2'><i>Changes will not be seen til you return to your alt list!</i></font>";
                        }
                    }
                    echo "<form action='?page=edit_alts&amp;mode=admin&amp;&amp;e=1&amp;alt=$trade_id' method='post'>";
                    echo "<table border='0' cellpadding='0' cellspacing='10'>";
                    echo "<input type='hidden' name='edited' value='$trade_id' />";
                    echo "<tr><td><font size='-2'>Owned Alt</font><br /><input type='text' name='name' value='$name1' size='15' /></td></tr>";
                    echo "<tr><td><font size='-2'>Trade Level</font><br /><select name='level'>";
                    echo "<option value='6'"; if($level1 == 6){ echo "selected";} echo ">Open for Trade</option>";
                    echo "<option value='5'"; if($level1 == 5){ echo "selected";} echo ">On Hold</option>";
                    echo "<option value='4'"; if($level1 == 4){ echo "selected";} echo ">Not For Trade</option>";
                    echo "</select></td></tr>";
                    echo "<tr><td><font size='-2'>Comments:</font><br /><textarea name='comments'>$comments1</textarea></td></tr>";
                    echo "<tr><td><br /><input type='submit' value='Edit Alt'></td></tr></table>";
                    echo "</form>";

                } else {
                    echo "<br />There's no way you're supposed to be here.. Tisk tisk.";
                }
                }
            break;
[/code]

When this is run, it echos '1' for the $user_level variable, but it still shows "<br />There's no way you're supposed to be here.. Tisk tisk."

Anyone have any ideas why?
Link to comment
https://forums.phpfreaks.com/topic/7799-odd-if-statement-problems/
Share on other sites


[code]
if(! $user_level == 1) {
                        echo "$user_level<br />There's no way you're supposed to be here.. Tisk tisk.";
[/code]

[code]
if($user_level ! >0) {
                        echo "$user_level<br />There's no way you're supposed to be here.. Tisk tisk.";
[/code]


Tried good luck!
[!--quoteo(post=366279:date=Apr 18 2006, 10:03 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Apr 18 2006, 10:03 PM) [snapback]366279[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]
if(! $user_level == 1) {
                        echo "$user_level<br />There's no way you're supposed to be here.. Tisk tisk.";
[/code]

[code]
if($user_level ! >0) {
                        echo "$user_level<br />There's no way you're supposed to be here.. Tisk tisk.";
[/code]
Tried good luck!
[/quote]


I can't remember what I did, but I managed to fix it a couple minutes ago. Thanks for the reply though. =)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.