Jump to content


Photo

PHP Error


  • Please log in to reply
6 replies to this topic

#1 R1der

R1der
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts

Posted 30 August 2006 - 10:49 AM

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
if ($user[uRank==3]) {  // this is line 33
				        echo;
		                7 => 'Staff General',
		                8 => 'Staff bug report');


Thanks for your time

#2 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 30 August 2006 - 10:54 AM

You are missing a closing bracket on the preceeding block of code.


#3 R1der

R1der
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts

Posted 30 August 2006 - 10:55 AM

no the closing bracket is in my code just didnt copy my code that far down

#4 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 30 August 2006 - 10:56 AM

Well, I don't really see what you want to accomplish with this code, but my observations:
1. the code for the if
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

Ronald  8)

RTFM is an almost extinct art form, it should be subsidized.

#5 R1der

R1der
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts

Posted 30 August 2006 - 11:06 AM

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


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.

        $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');
				}

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

Thanks

#6 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 30 August 2006 - 11:30 AM

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:
<?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']);
}
?>

Ronald  8)
RTFM is an almost extinct art form, it should be subsidized.

#7 sasa

sasa
  • Staff Alumni
  • Advanced Member
  • 2,804 posts
  • LocationHrvatska

Posted 30 August 2006 - 07:22 PM

or
$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';
}





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users