Jump to content

Archived

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

R1der

PHP Error

Recommended Posts

Hey guys

Ok i am having a bit of trouble i am getting a error in my php coding can you help please.

This is the error

Parse error: parse error, unexpected T_IF, expecting ')' in ***********************forums.php on line 33

This is the code
[code]if ($user[uRank==3]) {  // this is line 33
        echo;
                7 => 'Staff General',
                8 => 'Staff bug report');[/code]


Thanks for your time

Share this post


Link to post
Share on other sites
You are missing a closing bracket on the preceeding block of code.

Share this post


Link to post
Share on other sites
no the closing bracket is in my code just didnt copy my code that far down

Share this post


Link to post
Share on other sites
Well, I don't really see what you want to accomplish with this code, but my observations:
1. the code for the if
[code]if ($user[uRank] ==3)[/code]
2. you do not close your opening brace
3. what does the empty echo do?
4. what are the key 7 and 8 assignments doing in the 'if' result?
5. your closing parenth does not have an opening parenth

Ronald  8)

Share this post


Link to post
Share on other sites
[quote]Well, I don't really see what you want to accomplish with this code, but my observations:
1. the code for the if

Code:
if ($user[uRank] ==3)2. you do not close your opening brace
3. what does the empty echo do?
4. what are the key 7 and 8 assignments doing in the 'if' result?
5. your closing parenth does not have an opening parenth
[/quote]

1. i dont understand what u mean.
2. there is a closing bracket i just didnt copy that far down in my code.
3. the echo is to echo the staff forums
4. there are 8 topics to my forum.
5. sorry but whats parenth mean?

more of my code to help you understand.

[code]        $forumz = array(1 => 'Announcements',
                        2 => 'General Discussion',
        3 => 'Newbie Help',
4 => 'Fun And Games',
        5 => 'Non-Game',
        6 => 'Game Help',
        if ($user[uRank==3]) {
        echo;
                7 => 'Staff General',
                8 => 'Staff bug report');
}[/code]

Edit... the if statement is so only staff with that urank can see the topics

Thanks

Share this post


Link to post
Share on other sites
I cannot find head or tail in your code, but my solution would be to define the array and to remove the entries if a user is not 3, with the following code:
[code]<?php
$forumz = array(1 => 'Announcements',
                2 => 'General Discussion',
  3 => 'Newbie Help',
  4 => 'Fun And Games',
  5 => 'Non-Game',
  6 => 'Game Help',
  7 => 'Staff General',
  8 => 'Staff bug report'
);
if ($user[uRank] != 3) {
  unset($forumz['7']);
  unset($forumz['8']);
}
?>[/code]

Ronald  8)

Share this post


Link to post
Share on other sites
or[code]
$forumz = array(1 => 'Announcements',
                      2 => 'General Discussion',
      3 => 'Newbie Help',
      4 => 'Fun And Games',
      5 => 'Non-Game',
      6 => 'Game Help');
if ($user[uRank==3]) {
  $forumz[7] = 'Staff General';
  $forumz[8] = 'Staff bug report';
}[/code]

Share this post


Link to post
Share on other sites

×

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.