Jump to content

Recommended Posts

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.  :facewall:

Link to comment
https://forums.phpfreaks.com/topic/169226-solved-php-code-missing-some-symbols/
Share on other sites

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?

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.  :facewall:

well if $post_data['poster_id'] is empty, you will get error, first try to echo $sql and see if everything is fine

$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.

$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

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.

 

 

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).

 

 

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
?>

$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

$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

 

$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

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.]

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

 

);

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);

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)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.