Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unexpected T_PRIVATE?

Status
Not open for further replies.

musa10

Technical User
Apr 7, 2005
26
US
Hello everyone,
I am newbie to PHP and MYSQL..Am getting the following error

Parse error: syntax error, unexpected T_PRIVATE, expecting ']' in C:\Program Files\Apache Group\Apache2\htdocs\amember\helpdesk\browse.php on line 342

Here is the line 342


else if( $row_post_user[private] )
$image = "browse_private.gif";


WHATS WRONG WITH IT?
 
At first look, it may be the missing braces...

[tt]
}
else {
if( $row_post_user[private] ) {
$image = "browse_private.gif";
}

}

[/tt]

Darrell
 
a) if you are using "private" as a constant index into an associative array QUOTE IT!!! (this is a pet peeve with my programmers, before I started railing on this point we were generating gigabytes of warnings in our error logs).

b) private is a reserved word, however if you quote it, as per "a", it wouldn't be an issue.

If it weren't a reserved word you would get a warning that you were using an unquoted literal and PHP was assuming 'private'.

 
Hello. Thanks for both of your responses. Tried both but no luck.. Here is a bigger portion of the code.




}

$res_post = mysql_query( "SELECT COUNT(*) FROM {$pre}post WHERE ( ticket_id =

'{$row[id]}' )" );
$row_post = mysql_fetch_array( $res_post );

$bgcolor = ($bgcolor == "#DDDDDD") ? "#EEEEEE" : "#DDDDDD";
echo "<tr bgcolor=\"$bgcolor\">";

if( $row[status] != $HD_STATUS_OPEN )
$image = "browse_closed.gif";
else if( $row_post[0] == 1 )
$image = "browse_newticket.gif";
else if( $row[lastpost] == -1 )
$image = "browse_newreply.gif";
else if( $row_post_user[private] )
$image = "browse_private.gif";
else
$image = "browse_nonew.gif";
 
The weird thing is that [private] is causing this error all over but once I remove it, everything works fine, so what is its importance?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top