I'm having a problem with this. When I run it and then browse the SQL table afterwords it does not run the SQL query. Help please <? require_once('back/facebook.php'); include_once('back/functions.php'); $apikey = 'xxx'; $secret = 'xxx'; $facebook = new Facebook($apikey, $secret); $connsql = mysql_connect(localhost, faceradio, xxx) or die ('Error connecting to mysql'); mysql_select_db("faceradio", $connsql); $uid = $facebook; $facebook->api_client->notifications_send($uid, 'testing 123', 'app_to_user'); mysql_query("INSERT INTO 'users' ('uid') VALUES ('$uid'), $connect") or die ('error ' mysql_error()); ?> Code (markup):
May be you meant this? <? mysql_query("INSERT INTO `users` (`uid`) VALUES ('$uid')", $connsql) ?> Code (markup):
$uid = $facebook; PHP: The error is above. you are copying Object of facebook class in $uid.. since i have developed facebook application. I guess you are missing here $facebook->require_login() call i.e $uid = $facebook->require_login(); PHP:
This is what I have now, but it quit sending the notifications and I'm still not getting the stuff inserted into the SQL table <? require_once('back/facebook.php'); include_once('back/functions.php'); $apikey = 'xxx'; $secret = 'xxx'; $facebook = new Facebook($apikey, $secret); $uid = $facebook->require_login(); $connsql = mysql_connect(localhost, faceradio, xxx); mysql_select_db("faceradio", $connsql); $facebook->api_client->notifications_send($uid, 'testing 123', 'app_to_user'); mysql_query("INSERT INTO 'users' ('uid') VALUES ('$uid')", $connsql); ?> PHP:
var_dump($uid); PHP: do this after $uid = $facebook->require_login(); PHP: and check whether its printing your facebook Id or not replace mysql_select_db("faceradio", $connsql); PHP: with mysql_select_db("faceradio", $connsql) or die("uzair"); PHP: Replace $connsql = mysql_connect(localhost, faceradio, xxx); PHP: with $connsql = mysql_connect("localhost", "faceradio", "xxx") or die("connection error"); PHP: Replace mysql_query("INSERT INTO 'users' ('uid') VALUES ('$uid')", $connsql); PHP: with mysql_query("INSERT INTO `users` (`uid`) VALUES ($uid)", $connsql); PHP: its just for debugging so do print the values over here if this dont solves your problem ..
The problem with dumping the variables is this is just the Post Authorize page that facebook pings after adding the application
The problem is with your query. You should not use single quotes for column names. Change this: mysql_query("INSERT INTO `users` (`uid`) VALUES ($uid)", $connsql); Code (markup): To: mysql_query("INSERT INTO users (uid) VALUES ('$uid')", $connsql); Code (markup):