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
https://forums.phpfreaks.com/topic/99654-ok-this-seems-really-simple/
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.

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>

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

 

 

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

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.

Archived

This topic is now archived and is closed to further replies.

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