R1der Posted August 30, 2006 Share Posted August 30, 2006 Hey guysOk i am having a bit of trouble i am getting a error in my php coding can you help please.This is the errorParse error: parse error, unexpected T_IF, expecting ')' in ***********************forums.php on line 33This 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 Quote Link to comment https://forums.phpfreaks.com/topic/19121-php-error/ Share on other sites More sharing options...
Jenk Posted August 30, 2006 Share Posted August 30, 2006 You are missing a closing bracket on the preceeding block of code. Quote Link to comment https://forums.phpfreaks.com/topic/19121-php-error/#findComment-82698 Share on other sites More sharing options...
R1der Posted August 30, 2006 Author Share Posted August 30, 2006 no the closing bracket is in my code just didnt copy my code that far down Quote Link to comment https://forums.phpfreaks.com/topic/19121-php-error/#findComment-82699 Share on other sites More sharing options...
ronverdonk Posted August 30, 2006 Share Posted August 30, 2006 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 brace3. 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 parenthRonald 8) Quote Link to comment https://forums.phpfreaks.com/topic/19121-php-error/#findComment-82700 Share on other sites More sharing options...
R1der Posted August 30, 2006 Author Share Posted August 30, 2006 [quote]Well, I don't really see what you want to accomplish with this code, but my observations:1. the code for the ifCode:if ($user[uRank] ==3)2. you do not close your opening brace3. 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 forums4. 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 topicsThanks Quote Link to comment https://forums.phpfreaks.com/topic/19121-php-error/#findComment-82701 Share on other sites More sharing options...
ronverdonk Posted August 30, 2006 Share Posted August 30, 2006 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) Quote Link to comment https://forums.phpfreaks.com/topic/19121-php-error/#findComment-82708 Share on other sites More sharing options...
sasa Posted August 30, 2006 Share Posted August 30, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/19121-php-error/#findComment-83076 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.