Help, I can't see the punctuation error!?

This is my code and I have an unexpected $end, can not see what is wrong…Please fresh eyes tell me if you can!! :o

<?php require_once('auth.php'); $querySelect = "SELECT name FROM users WHERE id = '".$_SESSION['SESS_MEMBER_ID']."'"; $resultSelect = mysql_query($querySelect); $row = mysql_fetch_array($resultSelect); $name = $row['name']; $sqlSelect = "SELECT permission FROM users WHERE id = '".$_SESSION['SESS_MEMBER_ID']."'"; $sqlResult = mysql_query($sqlSelect); $line = mysql_fetch_array($sqlResult); $perm = $line['permission']; ?> Index

Welcome <?php echo $name;?>

My Profile | Logout

This is a password protected area only accessible to members.

<?php if($line) { if($perm = 'admin') { include('admin.php'); } elseif($perm = 'manager') { include('manager.php'); } elseif($perm = 'client') { include('client.php'); } elseif($perm = 'staff') { include('staff.php'); } elseif($perm = 'DE') { include('DE.php'); } ?>

THANK YOU!!!

Hi there,

[code] } elseif($perm = ‘DE’) {
include(‘DE.php’); } ?>

[/code]

needs to be:

[code] } elseif($perm = ‘DE’) {
include(‘DE.php’); }
} ?>

[/code]

It was quite difficult to spot however as your formatting leaves much to be desired, I would suggest that you use tabs and new lines more effectively. This is of course personal opinion, but I would find the following layout much easier/clearer to read and simpler to debug:

<?php if($line) { if($perm == 'admin') { include('admin.php'); } else if($perm == 'manager') { include('manager.php'); } else if($perm == 'client') { include('client.php'); } else if($perm == 'staff') { include('staff.php'); } else if($perm == 'DE') { include('DE.php'); } } ?>

It takes up more room, but I find it much easier to work with. Also note the “==”, I have only just spotted that you had only used a single = in your “else if” statements - a single one can be used, but I don’t think you want to use just one in this example.

Let me know how it goes.

Sponsor our Newsletter | Privacy Policy | Terms of Service