Jump to content

Whats Wrong With This


Mod-Jay

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.