iamz3r0 Posted August 7, 2009 Share Posted August 7, 2009 I'm having issues with a new points system mod on my forums. I'm receiving: PHP Parse error: parse error' date=' expecting `')'' in ~ on line 1560 My code is: // Start Ultimate Points $sql = "UPDATE " . USERS_TABLE . " SET user_points = user_points - " . $post_data['points_received'] . " WHERE user_id = '" . $post_data['poster_id'] . "'"; $db->sql_query($sql); // End Ultimate Points Line 1560 is labled in red. I can't seem to find out where I'm missing the(se) symbols. Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/ Share on other sites More sharing options...
JonnoTheDev Posted August 7, 2009 Share Posted August 7, 2009 There is no sytax error with the above string. However check that the constant and variables have values: USERS_TABLE $post_data['points_received'] $post_data['poster_id'] Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892908 Share on other sites More sharing options...
waterssaz Posted August 7, 2009 Share Posted August 7, 2009 can you post a few lines of code before the query please? Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892909 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 There is no sytax error with the above string. However check that the constant and variables have values: USERS_TABLE $post_data['points_received'] $post_data['poster_id'] So, it could be having a problem connecting to a specific table in the PHP SQL database? Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892910 Share on other sites More sharing options...
br3nn4n Posted August 7, 2009 Share Posted August 7, 2009 There's nothing wrong there, it must be a different line. Are you sure that's the file it's talking about? Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892911 Share on other sites More sharing options...
JonnoTheDev Posted August 7, 2009 Share Posted August 7, 2009 No the string is broken if the values are empty. As the above post states post lines of code prior to the sql string. Expecting a syntax error. Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892913 Share on other sites More sharing options...
watsmyname Posted August 7, 2009 Share Posted August 7, 2009 I'm having issues with a new points system mod on my forums. I'm receiving: PHP Parse error: parse error' date=' expecting `')'' in ~ on line 1560 My code is: // Start Ultimate Points $sql = "UPDATE " . USERS_TABLE . " SET user_points = user_points - " . $post_data['points_received'] . " WHERE user_id = '" . $post_data['poster_id'] . "'"; $db->sql_query($sql); // End Ultimate Points Line 1560 is labled in red. I can't seem to find out where I'm missing the(se) symbols. well if $post_data['poster_id'] is empty, you will get error, first try to echo $sql and see if everything is fine Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892915 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 $data = array( 'topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_replies_real' => $post_data['topic_replies_real'], 'topic_approved' => $post_data['topic_approved'], 'topic_type' => $post_data['topic_type'], 'post_approved' => $post_data['post_approved'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], // Start Ultimate Points 'points_received' => $post_data['points_received'], //End Ultimate Points 'post_postcount' => $post_data['post_postcount'] // Start Ultimate Points $sql = "UPDATE " . USERS_TABLE . " SET user_points = user_points - " . $post_data['points_received'] . " WHERE user_id = '" . $post_data['poster_id'] . "'"; $db->sql_query($sql); // End Ultimate Points I'm sure it's the right file. It tells me its in the posting.php file. I can post the entire file as an attachment if it helps. Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892916 Share on other sites More sharing options...
JonnoTheDev Posted August 7, 2009 Share Posted August 7, 2009 $data = array( 'topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_replies_real' => $post_data['topic_replies_real'], 'topic_approved' => $post_data['topic_approved'], 'topic_type' => $post_data['topic_type'], 'post_approved' => $post_data['post_approved'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], // Start Ultimate Points 'points_received' => $post_data['points_received'], //End Ultimate Points 'post_postcount' => $post_data['post_postcount']); done Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892918 Share on other sites More sharing options...
waterssaz Posted August 7, 2009 Share Posted August 7, 2009 As above, you never closed the array. thats where the error was; Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892921 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 Parse error: syntax error, unexpected ')' in /home/westwind/public_html/phpbb3/posting.php on line 1564 See, while I'm not completely new, I get "tangled" up in all of the code. I don't seem to find errors that can be just about out in the open. Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892927 Share on other sites More sharing options...
br3nn4n Posted August 7, 2009 Share Posted August 7, 2009 Don't you have to put a , even after the last array item? edit...wait that makes no sense. Sorry I'm tired. I don't know how it could have moved 4 lines down, only 2 characters were added. Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892929 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 edit...wait that makes no sense. Sorry I'm tired. Don't worry, I haven't gone to sleep yet. I've been working on the forums. I can't seem to find what's wrong. Knowing me, it's ONE symbol (more than likely a ',' because of it's size). Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892932 Share on other sites More sharing options...
watsmyname Posted August 7, 2009 Share Posted August 7, 2009 edit...wait that makes no sense. Sorry I'm tired. Don't worry, I haven't gone to sleep yet. I've been working on the forums. I can't seem to find what's wrong. Knowing me, it's ONE symbol (more than likely a ',' because of it's size). Isn't this <?php $data = array( 'topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_replies_real' => $post_data['topic_replies_real'], 'topic_approved' => $post_data['topic_approved'], 'topic_type' => $post_data['topic_type'], 'post_approved' => $post_data['post_approved'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], // Start Ultimate Points 'points_received' => $post_data['points_received'], //End Ultimate Points 'post_postcount' => $post_data['post_postcount'] ?> should be this <?php $data = array( 'topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_replies_real' => $post_data['topic_replies_real'], 'topic_approved' => $post_data['topic_approved'], 'topic_type' => $post_data['topic_type'], 'post_approved' => $post_data['post_approved'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], // Start Ultimate Points 'points_received' => $post_data['points_received'], //End Ultimate Points 'post_postcount' => $post_data['post_postcount'] ); //seems to have this portion is missing there ?> Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892937 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 $data = array( 'topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_replies_real' => $post_data['topic_replies_real'], 'topic_approved' => $post_data['topic_approved'], 'topic_type' => $post_data['topic_type'], 'post_approved' => $post_data['post_approved'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], // Start Ultimate Points 'points_received' => $post_data['points_received'], //End Ultimate Points 'post_postcount' => $post_data['post_postcount'] ); // Start Ultimate Points $sql = "UPDATE " . USERS_TABLE . " SET user_points = user_points - " . $post_data['points_received'] . " WHERE user_id = '" . $post_data['poster_id'] . "'"; $db->sql_query($sql); // End Ultimate Points ); ^^^ That's what I have, I'm still getting: Parse error: syntax error, unexpected ')' in /home/westwind/public_html/phpbb3/posting.php on line 1565 Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892940 Share on other sites More sharing options...
br3nn4n Posted August 7, 2009 Share Posted August 7, 2009 I see a final closing parentheses there. Is that intentional? Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892960 Share on other sites More sharing options...
watsmyname Posted August 7, 2009 Share Posted August 7, 2009 $data = array( 'topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_replies_real' => $post_data['topic_replies_real'], 'topic_approved' => $post_data['topic_approved'], 'topic_type' => $post_data['topic_type'], 'post_approved' => $post_data['post_approved'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], // Start Ultimate Points 'points_received' => $post_data['points_received'], //End Ultimate Points 'post_postcount' => $post_data['post_postcount'] ); // Start Ultimate Points $sql = "UPDATE " . USERS_TABLE . " SET user_points = user_points - " . $post_data['points_received'] . " WHERE user_id = '" . $post_data['poster_id'] . "'"; $db->sql_query($sql); // End Ultimate Points ); ^^^ That's what I have, I'm still getting: Parse error: syntax error, unexpected ')' in /home/westwind/public_html/phpbb3/posting.php on line 1565 There might be some bracket missing that's why an error is thrown. might be error is somewhere in other lines. Can't say further unless we see whole code Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892964 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 Okay, this has me confuzzled . I've got the entire file in an attachment. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892965 Share on other sites More sharing options...
waterssaz Posted August 7, 2009 Share Posted August 7, 2009 $data = array( 'topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], 'topic_replies_real' => $post_data['topic_replies_real'], 'topic_approved' => $post_data['topic_approved'], 'topic_type' => $post_data['topic_type'], 'post_approved' => $post_data['post_approved'], 'post_reported' => $post_data['post_reported'], 'post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id'], // Start Ultimate Points 'points_received' => $post_data['points_received'], //End Ultimate Points 'post_postcount' => $post_data['post_postcount'] ); // Start Ultimate Points $sql = "UPDATE " . USERS_TABLE . " SET user_points = user_points - " . $post_data['points_received'] . " WHERE user_id = '" . $post_data['poster_id'] . "'"; $db->sql_query($sql); // End Ultimate Points ); ^^^ That's what I have, I'm still getting: I can not see the need for the last ); underneath the //End ultimate points Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892969 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 If I remove the ); I get: Parse error: syntax error, unexpected T_IF, expecting ')' in /home/westwind/public_html/phpbb3/includes/functions_posting.php on line 2020 [EDIT: Obviously, I've overlooked the parse error, it shows the error in another file.] Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892971 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 The location of the new error, in functions_posting.php // Start Ultimate Points if ( $post_mode == 'reply' && $config['points_enable'] ) { $ultimate_points->new_post_ch($data['forum_id'], $data['post_id'], $ultimate_points->strip_text($sql_data[postS_TABLE]['sql']['post_text'])); } // End Ultimate Points if ($post_mode == 'post') { $sql_data[topicS_TABLE]['sql'] = array( 'topic_first_post_id' => $data['post_id'], 'topic_last_post_id' => $data['post_id'], 'topic_last_post_time' => $current_time, 'topic_last_poster_id' => (int) $user->data['user_id'], 'topic_last_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''), 'topic_last_poster_colour' => $user->data['user_colour'], 'topic_last_post_subject' => (string) $subject, // Start Ultimate Points if ( $config['points_enable'] ) { $ultimate_points->new_topic_ch($data['forum_id'], $data['topic_id'], $sql_data[postS_TABLE]['sql']['post_text']); } // End Ultimate Points ); Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892979 Share on other sites More sharing options...
JonnoTheDev Posted August 7, 2009 Share Posted August 7, 2009 Again close off your arrays $sql_data[topicS_TABLE]['sql'] = array( 'topic_first_post_id' => $data['post_id'], 'topic_last_post_id' => $data['post_id'], 'topic_last_post_time' => $current_time, 'topic_last_poster_id' => (int) $user->data['user_id'], 'topic_last_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''), 'topic_last_poster_colour' => $user->data['user_colour'], 'topic_last_post_subject' => (string) $subject); Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892982 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 Alright, good news... and bad news. That edit worked, I can load up the page, but I'm getting the infamous "headers already sent by" errors. [phpBB Debug] PHP Notice: in file /includes/functions_posting.php on line 2514: Invalid argument supplied for foreach() [phpBB Debug] PHP Notice: in file /includes/session.php on line 1006: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247) [phpBB Debug] PHP Notice: in file /includes/session.php on line 1006: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247) [phpBB Debug] PHP Notice: in file /includes/session.php on line 1006: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247) [phpBB Debug] PHP Notice: in file /includes/functions.php on line 3835: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247) [phpBB Debug] PHP Notice: in file /includes/functions.php on line 3837: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247) [phpBB Debug] PHP Notice: in file /includes/functions.php on line 3838: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247) [phpBB Debug] PHP Notice: in file /includes/functions.php on line 3839: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247) Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892989 Share on other sites More sharing options...
JonnoTheDev Posted August 7, 2009 Share Posted August 7, 2009 Fix this first: PHP Notice: in file /includes/functions_posting.php on line 2514: Invalid argument supplied for foreach() Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-892996 Share on other sites More sharing options...
iamz3r0 Posted August 7, 2009 Author Share Posted August 7, 2009 Fix this first: PHP Notice: in file /includes/functions_posting.php on line 2514: Invalid argument supplied for foreach() On line 2514 it has: foreach ($sql_data as $table => $update_ary) Link to comment https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/#findComment-893001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.