Jump to content

Ok, this seems really simple.


Defibber

Recommended Posts

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 } ?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Ok, the ) was the problem, but you knew that ;D.  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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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[.....

 

 

Link to comment
Share on other sites

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 } ?>

Link to comment
Share on other sites

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.

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.