Jump to content

[SOLVED] Small problem


nitromaster

Recommended Posts

Currently creating a comment function for an app I have running on facebook.

 

I'm getting an error on the addcomment page though.

[31-Dec-2008 20:55:40] PHP Parse error:  syntax error, unexpected T_STRING in directory/addcomment.php on line 32

 

Line 32 is

mysql_query{$query);

with $query set above.

 

Full page code is as follows

facebook.php is the facebook api lib, config.php defines mysql user/database and api key/secret.

userid is set to the userid of whoevers using the app.

 

<?php
require_once 'facebook.php';
require_once 'config.php';

$facebook = new Facebook($FACEBOOK_API, $FACEBOOK_SECRET);
$user_id = $facebook->require_login();

if(isset($_POST['commentplz']))
{
  $poster_id = $_POST['fb_sig_user'];
  $admin_id = $_POST['fb_sig_user'];
  $member_id = $_POST['to'];
  $message_tx = mysql_real_escape_string($_POST['message_tx']);
  $photo_id = $_POST['photo_id'];
  $timestamp = time();
}
else
{
  echo '<fb:redirect url="http://apps.facebook.com/appname/" />';
}

echo '<fb:tabs>
<fb:tab-item href="http://apps.facebook.com/appname/" title="Index" selected="true"/>
   <fb:tab-item href="http://apps.facebook.com/appname/invite.php" title="Invite Friends"/>
<fb:tab-item href="http://apps.facebook.com/appname/mycomments" title="My Received Comments"/>
</fb:tabs>';

	mysql_connect($SQL_HOST,$SQL_USER,$SQL_PASS) or die(mysql_error());
	@mysql_select_db($SQL_DB) or die( "Unable to select database");
	$query = "INSERT INTO comments VALUES ('" . $poster_id . "','" . $admin_id . "','" . $member_id . "', '" . $message_tx . "', '" . $photo_id . "', '" . $timestamp . "')";
	mysql_query($query);
	 if (mysql_affected_rows($query) > 0) {
            echo "Comments inserted\n";
        }
	else
	{
	echo "Error";
	}

	mysql_close();

?>

 

Any ideas?

Probaly something really easy but I've looked over it a few times and it all looks good  ???

Thanks

 

Link to comment
Share on other sites

Was away since so didn't get to have another look at this until now.

 

Seems the encoding got messed up around there and when I viewed via the edit page in cpanel file manager it showed

	ÊifÊ(mysql_affected_rows($query)Ê>Ê0)Ê{
ÊÊÊÊÊÊÊÊÊÊÊÊechoÊ"CommentsÊinserted\n";
ÊÊÊÊÊÊÊÊ}

Whoops, no wonder it was having problems :L

 

 

Link to comment
Share on other sites

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.