NSA
sudo apt-get thefuckout.tar.gz
- Dec 9, 2011
- 715
- 86
For some reason PHP is throwing this error at me:
Notice
: Undefined variable: rank in
C:\xampp\htdocs\main\user_bar.html
on line
18
Here is my code (I hope you can find the error because I sure as hell can't!):
PHP:
$q = mysql_query("SELECT * FROM users WHERE username = '$username'");
while($row = mysql_fetch_assoc($q)){
$rank = $row['rank'];
echo $rank;
}
?>
<div id="top_bar">
Welcome back, <?php echo $_SESSION['myusername'] . " ";?><br />
| <a href="logout.php">Logout</a>
<?php
if($rank == "admin"){
echo " | <a href=\"add_post.php\">Create Blog Post</a> | ";
}else{
}
?>
<a href="messages.php">Messages</a> |
</div>