Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 10-28-2005, 02:57 PM Parse Error
Junior Talker

Posts: 1
Trades: 0
I keep recieving

Code:
Parse error: parse error, unexpected $ in /home/jayleesy/public_html/bbhead2.php on line 48
In this coding
PHP Code:
<?php
if($userdata['session_logged_in']){//logged in

if ( $userdata['user_new_privmsg'] )//private messages
    
{
        
$l_message_new = ( $userdata['user_new_privmsg'] == ) ? $lang['New_pm'] : 

$lang['New_pms']; 
        
$l_privmsgs_text sprintf($l_message_new$userdata['user_new_privmsg']); 

        if ( 
$userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
        {
            
$sql "UPDATE " USERS_TABLE "
                SET user_last_privmsg = " 
$userdata['user_lastvisit'] . 
                WHERE user_id = " 
$userdata['user_id'];
            if ( !
$db->sql_query($sql) )
            {
                
message_die(GENERAL_ERROR'Could not update private message 

new/read time for user'
''__LINE____FILE__$sql);
            }

            
$s_privmsg_new 1;
            
$icon_pm $images['pm_new_msg'];
        }
        else
        {
            
$s_privmsg_new 0;
            
$icon_pm $images['pm_no_new_msg'];
        }
    }
    else
    {
        
$l_privmsgs_text $lang['No_new_pm'];

        
$s_privmsg_new 0;
        
$icon_pm $images['pm_no_new_msg'];
    }

    if ( 
$userdata['user_unread_privmsg'] )
    {
        
$l_message_unread = ( $userdata['user_unread_privmsg'] == ) ? 

$lang['Unread_pm'] : $lang['Unread_pms']; 
        
$l_privmsgs_text_unread sprintf($l_message_unread

$userdata['user_unread_privmsg']); 
    }
    else
    {
        
$l_privmsgs_text_unread $lang['No_unread_pm'];
    }
?>
I've tried to locate the error myself, but I'm having no such luck. Perhaps someone else can spot what I keep missing?
kyle19208 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-28-2005, 03:55 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
You are missing a final } to match with if($userdata['session_logged_in']){//logged in

That's all that pops out at me.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 10-29-2005, 01:09 PM
AxE
AxE's Avatar
Skilled Talker

Posts: 62
Trades: 0
That error usually comes when you miss off a } somewhere, as 0beron said. I find it easier to work with PHP when I ident by a certain amount of spaces each time, such as:

PHP Code:
if($blah=="Yes"){
     echo 
"Yes!!";
}else{
     if(
$Yeah=="yup!"){
          echo 
"Yup!";
     }else{
          echo 
"Nope!";
     }

This way I can always see how many brackets I need to add at the end. DreamWeaver is good for this, as you can just press Tab to indent by about 10 spaces, which is a good amount of spotting the missing bracket.

Also, another good habit is writing your code like this:
PHP Code:
if($blah == "Yes!"){ 
Then
PHP Code:
if($blah == "Yes!"){


Then
PHP Code:
if($blah == "Yes!"){
     
//Whatever your code is here
     //And here
     //And here

Notice that I added the "}" as soon as I finished the if(), that way if I get caught up with my coding I *cant* forget to close brackets.



Just some hints
AxE is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Parse Error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27777 seconds with 12 queries