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 7691503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:38:22+00:00 2026-05-31T20:38:22+00:00

Hey everyone, i do the following query to get a user statuses: FB.api( {

  • 0

Hey everyone,

i do the following query to get a user statuses:

FB.api(
    {
        method: 'fql.query',
        query: 'SELECT message FROM statuses WHERE uid = ' + userId
    },
    function(data) {
        //    do something with the response
    }

);

It works great when the number of result are more than 0.

but when there are no results, the callback function is not called at all.

i need to know if there are 0 rows returning from this query, is there any way to do it?

Thanks 🙂

  • 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-05-31T20:38:23+00:00Added an answer on May 31, 2026 at 8:38 pm

    First of all, the statuses table does not exists. You should be using status table.

    The callback is always called but you should properly check against empty objects. Just paste this on the Javascript Test Console:

    <fb:login-button scope="read_stream">
        Grant access to statuses
    </fb:login-button>
    
    <button onclick="getStatuses()">Get Statuses</button>
    <script>
    window.getStatuses = function() {
        FB.api(
        {
            method: 'fql.query',
            query: 'SELECT message FROM status WHERE uid = me() AND time < 315532800'
        },
        function(data) {
            if(!isEmpty(data)) {
                for(var key in data) {
                    var obj = data[key];
                    console.log(obj['message'])
                }
            } else {
                console.log("data is empty")
            }
        });
    };
    
    function isEmpty(obj) {
        for(var prop in obj) {
            if(obj.hasOwnProperty(prop))
                return false;
        }
    
        return true;
    }
    </script>
    

    Here I am checking for statuses before 1/1/1980 to insure that an empty result is returned. In your console you should note the data is empty response.

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

Sidebar

Related Questions

Hey everyone, I have a database result that returns from a method. I need
Hey everyone. The following is the code that I am using to play random
Hey everyone, I am trying to run the following program, but am getting a
Hey everyone, I have achieved the effect described in the title using the following
Hey everyone, I need to convert the following format into a new format using
Hey everyone, in the following code, what should the result of d be after
Hey everyone :) I'm having a small issue and i'd love to hear from
Hey everyone, I'm trying to type a regular expression that follows the following format:
Hey everyone I am trying to get back into Spring programming on tomcat6. Can
Hey everyone, I have the following 'users' table in MySQL: CREATE TABLE `users` (

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.