Defibber Posted April 5, 2008 Share Posted April 5, 2008 Ok, Again I am using DW8 and trying to hide a menu using this code and I get this error. Parse error: syntax error, unexpected '{' in //........................... on line 185 (which is the second line - { ?><div> ) I've tried putting ";" before and after the { with no luck. <?php if (isset($_SESSION['MM_UserGroup']) && (($_SESSION['MM_UserGroup']=='Member' ) || ($_SESSION['MM_UserGroup']=='Admin' )) { ?><div> <table width="75%" border="0"> <tr> <td colspan="2" class="page_header">Member's Only View </td> </tr> <tr> <td class="column_heading">Description</td> <td class="column_heading">Result</td> </tr> <tr> <td width="20%">Status: </td> <td width="80%"><?php echo $row_rsVideo_detail['status']; ?></td> </tr> </table> </div><?php } ?> Quote Link to comment Share on other sites More sharing options...
benjaminbeazy Posted April 5, 2008 Share Posted April 5, 2008 add another parenthesis at the end of your long if statement. Quote Link to comment Share on other sites More sharing options...
haku Posted April 5, 2008 Share Posted April 5, 2008 Errors are as often as not NOT on the line that it is given. the line number given is just the line where PHP has come to something that it cant make sense of. Usually that is because someone has made a mistake in one of the lines before. Quote Link to comment Share on other sites More sharing options...
Defibber Posted April 5, 2008 Author Share Posted April 5, 2008 Ok, the ) was the problem, but you knew that . I just didn't look far enough back. But now the code does not appear to be working. I know that My login is setting the session correctly because I can get into the Admin area but I cannot view the table that I have now hidden. I know some basic PHP but to me it looks correct. I realize that about the errors, that is where I usually start and work backwards but people a lot of times request the line number so I threw it in there. Thanks for your help so far. Quote Link to comment Share on other sites More sharing options...
Defibber Posted April 5, 2008 Author Share Posted April 5, 2008 Ok I have gone back to the Original code (listed Below) and it still does not show me the table. Any Ideas? <div> <?php if (isset($_SESSION['MM_UserGroup']) && $_SESSION['MM_UserGroup']=='Admin' ) { ?>.<table width="75%" border="0"> <tr> <td colspan="2" class="page_header">Member's Only View </td> </tr> <tr> <td class="column_heading">Description</td> <td class="column_heading">Result</td> </tr> <tr> <td width="20%">Status: </td> <td width="80%"><?php echo $row_rsVideo_detail['status']; ?></td> </tr> </table><?php } ?> </div> Quote Link to comment Share on other sites More sharing options...
unsider Posted April 5, 2008 Share Posted April 5, 2008 We need more information to fix this error. Try echoing all the session values. Test outputs, everything. if(!isset($_SESSION[..... Quote Link to comment Share on other sites More sharing options...
Defibber Posted April 5, 2008 Author Share Posted April 5, 2008 I did Echo the Sessions and they are there and correct. I am confused about the - if(!isset($_SESSION[..... ) what does it do? I tried it and didn't have any luck. We need more information to fix this error. Try echoing all the session values. Test outputs, everything. if(!isset($_SESSION[..... Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted April 5, 2008 Share Posted April 5, 2008 isset check to see if anything is stored in it. You don't need that there, you're already checking that when you compare it to "admin" delete that isset part. Quote Link to comment Share on other sites More sharing options...
Defibber Posted April 5, 2008 Author Share Posted April 5, 2008 I broke it down to this and got the same results. I built a page that echo's the two sessions that my login page sets and I get the appropriate results. Same case and everything. <?php if ($_SESSION['MM_UserGroup']=='Admin' ) { ?>.<table width="75%" border="0"> <tr> <td colspan="2" class="page_header">Member's Only View </td> </tr> <tr> <td class="column_heading">Description</td> <td class="column_heading">Result</td> </tr> <tr> <td width="20%">Status: </td> <td width="80%"><?php echo $row_rsVideo_detail['status']; ?></td> </tr> </table><?php } ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted April 5, 2008 Share Posted April 5, 2008 the original code you had if (isset($_SESSION['MM_UserGroup']) && $_SESSION['MM_UserGroup']=='Admin' ) was more robust than it is now after following ohdang's advice. If it isn't set and you try to reference it then it will generate a warning. OK, you can wind down the error reporting level but that just sweeps bad coding practice under the carpet. Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted April 5, 2008 Share Posted April 5, 2008 oh. Quote Link to comment Share on other sites More sharing options...
Barand Posted April 5, 2008 Share Posted April 5, 2008 Have you called session_start() at the beginning of this page? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.