Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-13-2010, 02:26 AM Some PHP Help Urgent
Super Talker

Posts: 121
Trades: 0
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

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);
}
?> 
and this is the add user file

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
bikerboys is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-13-2010, 06:05 AM Re: Some PHP Help Urgent
Super Talker

Posts: 139
Name: John Davis
Trades: 0
Is there some error messages?
Are you sure this user is not already exist.
Are you sure SQL query takes result?
__________________
»
Please login or register to view this content. Registration is FREE
- Interactive maps for websites
»
Please login or register to view this content. Registration is FREE
for web developers
MapMaster is offline
Reply With Quote
View Public Profile Visit MapMaster's homepage!
 
Old 08-13-2010, 06:12 AM Re: Some PHP Help Urgent
Super Talker

Posts: 121
Trades: 0
no error message for some reason i get null when i add var_dump($facebook->get_loggedin_user()); to the add user.php file
bikerboys is offline
Reply With Quote
View Public Profile
 
Old 08-13-2010, 06:14 AM Re: Some PHP Help Urgent
Super Talker

Posts: 121
Trades: 0
and database is empty can get files here http://immortalbattle.com/eminem/test.zip
bikerboys is offline
Reply With Quote
View Public Profile
 
Old 08-13-2010, 02:26 PM Re: Some PHP Help Urgent
Super Talker

Posts: 121
Trades: 0
Quote:
Originally Posted by shiplu13 View Post
you may find ur recovery....
i find you made some wrong.....
in catch section you must use io exception..
but here u only use exception..

im not sure what you mean
bikerboys is offline
Reply With Quote
View Public Profile
 
Old 08-13-2010, 02:37 PM Re: Some PHP Help Urgent
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Quote:
Originally Posted by bikerboys View Post
im not sure what you mean
does anyone?

I assume he means this bit:

}
catch(
Exception $ex)
{
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 08-13-2010, 02:39 PM Re: Some PHP Help Urgent
Super Talker

Posts: 121
Trades: 0
so it should be changed to what
bikerboys is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Some PHP Help Urgent
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24839 seconds with 12 queries