Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
[PHP] Can't find error
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="NSA" data-source="post: 183686" data-attributes="member: 10034"><p>For some reason PHP is throwing this error at me: </p><p><strong><p style="text-align: center"><span style="font-size: 19px"><span style="font-family: 'Curantyle'"><span style="color: #000000">Notice</span></span></span></p><p></strong><p style="text-align: center"><span style="font-size: 19px"><span style="font-family: 'Curantyle'"><span style="color: #000000">: Undefined variable: rank in </span></span></span></p><p><strong><p style="text-align: center"><span style="font-size: 19px"><span style="font-family: 'Curantyle'"><span style="color: #000000">C:\xampp\htdocs\main\user_bar.html</span></span></span></p><p></strong><p style="text-align: center"><span style="font-size: 19px"><span style="font-family: 'Curantyle'"><span style="color: #000000"> on line </span></span></span></p><p><strong><p style="text-align: center"><span style="font-size: 19px"><span style="font-family: 'Curantyle'"><span style="color: #000000">18</span></span></span></p><p></strong> </p><p><strong><p style="text-align: center"><span style="font-size: 19px"><span style="font-family: 'Curantyle'"><span style="color: #000000">Here is my code (I hope you can find the error because I sure as hell can't!):</span></span></span></p><p></strong> </p><p>[PHP]$q = mysql_query("SELECT * FROM users WHERE username = '$username'");</p><p>while($row = mysql_fetch_assoc($q)){</p><p>$rank = $row['rank'];</p><p>echo $rank;</p><p>}</p><p>?></p><p><div id="top_bar"></p><p>Welcome back, <?php echo $_SESSION['myusername'] . " ";?><br /></p><p>| <a href="logout.php">Logout</a></p><p><?php</p><p>if($rank == "admin"){</p><p>echo " | <a href=\"add_post.php\">Create Blog Post</a> | ";</p><p>}else{</p><p> </p><p>}</p><p>?></p><p><a href="messages.php">Messages</a> |</p><p></div>[/PHP]</p></blockquote><p></p>
[QUOTE="NSA, post: 183686, member: 10034"] For some reason PHP is throwing this error at me: [B][CENTER][SIZE=19px][FONT=Curantyle][COLOR=#000000]Notice[/COLOR][/FONT][/SIZE][/CENTER][/B][CENTER][SIZE=19px][FONT=Curantyle][COLOR=#000000]: Undefined variable: rank in [/COLOR][/FONT][/SIZE][/CENTER][B][CENTER][SIZE=19px][FONT=Curantyle][COLOR=#000000]C:\xampp\htdocs\main\user_bar.html[/COLOR][/FONT][/SIZE][/CENTER][/B][CENTER][SIZE=19px][FONT=Curantyle][COLOR=#000000] on line [/COLOR][/FONT][/SIZE][/CENTER][B][CENTER][SIZE=19px][FONT=Curantyle][COLOR=#000000]18[/COLOR][/FONT][/SIZE][/CENTER][/B] [B][CENTER][SIZE=19px][FONT=Curantyle][COLOR=#000000]Here is my code (I hope you can find the error because I sure as hell can't!):[/COLOR][/FONT][/SIZE][/CENTER][/B] [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>[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
[PHP] Can't find error
Top