Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8918303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:43:03+00:00 2026-06-15T05:43:03+00:00

I have a strange, but definitely serious problem regarding fetching data from some Facebook

  • 0

I have a strange, but definitely serious problem regarding fetching data from some Facebook users who authorize my App and use it (normally by the way).

Around 3000 users have used the App so far, but only 600 are showing up in the users table. How could that be possible? I cannot find connection between old and new users – for some it works flawlessly, for others it just doesn’t work at all.

Here’s the complete, but for security reasons censored code:

<?php
 require 'facebook.php';
 include 'config.php';
 session_start();

 $app_id = 'id';
 $app_secret = 'secret';
 $app_namespace = 'namespace';
 $app_url = 'https://apps.facebook.com/' . $app_namespace . '/';
 $scope = 'email,publish_actions';

// Init the Facebook SDK

    $facebook = new Facebook(array(
    'appId'  => $app_id,
    'secret' => $app_secret,
    'cookie' => true
    ));

// Get the current user

 $user = $facebook->getUser();

// If the user has not installed the app, redirect them to the Auth Dialog

 if (!$user) {
    $loginUrl = $facebook->getLoginUrl(array(
    'scope' => $scope,
    'redirect_uri' => $app_url,
    ));

print('<script> top.location.href=\'' . $loginUrl . '\'</script>');
 }

 else if ($user) {
    try {

// Proceed knowing we have a logged in user who’s authenticated.

    $fbuid = $facebook->getUser();
    $user_profile = $facebook->api('/me');



} catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
}
 }
else{
header('Location: index.php');

 }
 $queryUserExists = mysql_query("SELECT * FROM users WHERE oauth_provider = 'facebook'AND oauth_uid = " . $user_profile['id']);
 $num=mysql_numrows($queryUserExists);

//If not, add it to the database

 if ($num == 0) {
$query = mysql_query("INSERT INTO users (oauth_uid, oauth_provider, username, first_name, last_name, email, pic_square ,login_date , dailytokens) 
        VALUES ({$user_profile['id']}, 'facebook', '{$user_profile['name']}', '{$user_profile['first_name']}','{$user_profile['last_name']}','{$user_profile['email']}', '".$photolink."',CURDATE(),1)");
$query = mysql_query("SELECT * FROM users WHERE oauth_uid = " . mysql_insert_id());
$result = mysql_fetch_array($query); 
 }
     else
     {
    $DateLastLogin=mysql_result($queryUserExists,0,"login_date");
    $myDate = date('Y-m-d');

    $CompLastDate = strtotime($DateLastLogin);
    $CompMyDate = strtotime($myDate);

if($CompLastDate < $CompMyDate){
    $updateDailyToken = "Update users set login_date=CURDATE(), dailytokens = dailytokens + 1 where oauth_uid =" . $user_profile['id'];
    $updateToken= mysql_query($updateDailyToken) or die(mysql_error());
}
 }
 $query = mysql_query("SELECT * FROM users WHERE oauth_provider = 'facebook' AND oauth_uid = " . $user_profile['id']);

 $_SESSION['userid']=$user_profile['id'];

// Login or logout url will be needed depending on current user state.

     if ($user) {
    $paramsout = array('next'=>'http://facebook.com');
    $logoutUrl = $facebook->getLogoutUrl($paramsout);
     }
     ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:43:04+00:00Added an answer on June 15, 2026 at 5:43 am

    Problem was with the object type in the database. Some facebook users have incredebly large id: 0098788563000236 for example, so using BIGINT instead of INT solved it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a contact page, but I have a strange problem. Right from the
I have strange problem with receiving data from socket. On client im using air
I have a feeling my problem is a bit strange, but here goes... I
I have a strange but simple problem with the .animate() function in IE9. I
I have got an strange problem but I am quite sure, for you it
I have strange problem, with calling Lua function from C++. I have in Lua:
I tried to draw a model with 197 polygons but i have strange black
I know it's a simple question, but I have strange behaviour in here. <pre>
Strange, but I can't find a duplicate for this question. I have a superclass
I realize it's probably something strange, but here is what I have. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.