Mod-Jay Posted September 4, 2010 Share Posted September 4, 2010 Cant Figure Out Whats Wrong With it.. Code: <?php if(isset($_SESSION['user'])) { $bb = mysql_query("SELECT * FROM main WHERE id=". $_SESSION['id']) or die ("An error has occured: " . mysql_error()); while($n=mysql_fetch_array($bb)) { ?> <div class='cs_article'> <div class='left'> <h2>User Control Panel</h2> <p><a href="usercp.php">User CP</a><?php if($n['rights'] == 1) { echo ", <a href="modcp.php">Mod CP</a>"; }?> <?php if($n['rights'] == 2) { echo ", <a href="aa/">Admin CP</a>"; }?> <div class='button'><a href='usercp.php'>Read more</a></div> </div> <div class='right'> <h1>User CP</h1> </div> </div> <?php }} ?> What its doing: Mod-Justin Compared to Mod-Justin Link to comment https://forums.phpfreaks.com/topic/212527-whats-wrong-with-this/ Share on other sites More sharing options...
JasonLewis Posted September 4, 2010 Share Posted September 4, 2010 You should be get errors when you run this script. The errors will tell you where the problem is. Look at this line: echo ", <a href="modcp.php">Mod CP</a>"; You are opening a string with quotes, then inside the string you are using the quotes again. This is a no-no, because PHP thinks you are ending the string, and so it throws an error. You need to either escape the quotes, or use single quotes on the inside or outside. echo ", <a href=\"modcp.php\">Mod CP</a>"; or echo ", <a href='modcp.php'>Mod CP</a>"; or echo ', <a href="modcp.php">Mod CP</a>'; You do the same thing a few lines down. You really need to look at your errors and check the lines out, then do a quick search on Google for the error. Generally these syntax errors are very easy to fix. Link to comment https://forums.phpfreaks.com/topic/212527-whats-wrong-with-this/#findComment-1107211 Share on other sites More sharing options...
Mod-Jay Posted September 4, 2010 Author Share Posted September 4, 2010 Thanks Once Again To someone Who Helped If u Looked At the Page, You Would see I didnt get an Error Link to comment https://forums.phpfreaks.com/topic/212527-whats-wrong-with-this/#findComment-1107214 Share on other sites More sharing options...
JasonLewis Posted September 4, 2010 Share Posted September 4, 2010 Thanks Once Again To someone Who Helped If u Looked At the Page, You Would see I didnt get an Error I pasted your code and ran it, I received the syntax errors which you should have received. Link to comment https://forums.phpfreaks.com/topic/212527-whats-wrong-with-this/#findComment-1107218 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.