Hi all Im haveing a issue here with this script adding peps to the datadatabase not sure why it dont
PHP help urgent
20
Hi all
Im haveing a issue here with this script adding peps to the datadatabase not sure why it dont
This is the config file for it
and this is the add user file
im so lost any help would be great
thanks
Im haveing a issue here with this script adding peps to the datadatabase not sure why it dont
This is the config file for it
PHP Code:
//----------- added 20.07.2010-----------
function user_add($facebook,$curr_user)
{
if( !$facebook )
{
return "testing...";
}
try
{
$q = "SELECT uid, first_name, last_name
FROM user WHERE uid=".$curr_user;
$rs = $facebook->api_client->fql_query($q);
// Build an delimited list of users...
if ( $rs )
{
$count = count($rs);
for( $i=0; $i < $count; $i++ )
{
$u_id = intval($rs[$i]["uid"]);
$f_name = trim($rs[$i]["first_name"]);
$l_name = trim($rs[$i]["last_name"]);
$name = $f_name." ".$l_name;
break;
}
}
}
catch(Exception $ex)
{
echo $ex->getMessage();
}
if( isset($u_id) AND $u_id )
{
@db_execute("INSERT INTO `user` (`id` ,`name` )VALUES (".$u_id.", '".$name."');");
}
}
function user_exists($curr_user)
{
$sql = "SELECT id FROM `user` WHERE id=$curr_user;";
$query = @db_execute($sql);
if( $query )
return mysql_num_rows($query);
}
?>
PHP Code:
<?php
require_once('facebook-client/facebook.php');
$facebook = new Facebook_new($api_key,$secret);
//echo "currr user: $curr_user<br>";
if( $facebook->get_loggedin_user() )
{
$curr_user = $facebook->require_login();
if( !user_exists($curr_user) )
{
@user_add($facebook,$curr_user);
//echo "<br> added new user!";
}
else
{
//echo "<br>user already exists!";
}
}
?> im so lost any help would be great
thanks
- jwlnewsome
- Gdubbs316
- jwlnewsome
- deepakg
- Gdubbs316
- Gdubbs316
- jwlnewsome
- [1] reply
- Gdubbs316
- jwlnewsome
- Gdubbs316
- jwlnewsome
- Gdubbs316
- jwlnewsome
- Gdubbs316
- jwlnewsome
- Gdubbs316
- jwlnewsome
- weaveronline
Next Topics on Trending Feed
-
20