nitromaster Posted January 1, 2009 Share Posted January 1, 2009 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 https://forums.phpfreaks.com/topic/139124-solved-small-problem/ Share on other sites More sharing options...
ratcateme Posted January 1, 2009 Share Posted January 1, 2009 check the line again mysql_query{$query); Scott. Link to comment https://forums.phpfreaks.com/topic/139124-solved-small-problem/#findComment-727638 Share on other sites More sharing options...
DarkerAngel Posted January 1, 2009 Share Posted January 1, 2009 check the line again mysql_query{$query); Scott. It looked like he just typed that in cause it don't appear that way in the code he pasted. Though I can't say for sure cause he hasn't responded. Link to comment https://forums.phpfreaks.com/topic/139124-solved-small-problem/#findComment-727643 Share on other sites More sharing options...
nitromaster Posted January 1, 2009 Author Share Posted January 1, 2009 check the line again mysql_query{$query); Scott. It looked like he just typed that in cause it don't appear that way in the code he pasted. Though I can't say for sure cause he hasn't responded. Whoops, I typed that, not in my code. Link to comment https://forums.phpfreaks.com/topic/139124-solved-small-problem/#findComment-727645 Share on other sites More sharing options...
ratcateme Posted January 1, 2009 Share Posted January 1, 2009 i sorry i see now i ran you code through a syntax checker and the code you have posted is error free. the error defiantly isn't coming from that code you posted. Scott. Link to comment https://forums.phpfreaks.com/topic/139124-solved-small-problem/#findComment-727651 Share on other sites More sharing options...
nitromaster Posted January 5, 2009 Author Share Posted January 5, 2009 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 https://forums.phpfreaks.com/topic/139124-solved-small-problem/#findComment-730360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.