Jump to content

Recommended Posts

Hi

I make a query to a database, normally it gives back a 0, now I want that the script keeps in touch with the database till the row gives back one. Till now I made it with a setInterval and went through the function again and again, but I think it's not really good for the database. Can't the function wait in the query till comes back a 1 and then doing something? Here is what I got so far:

 

    function latestCheckFB()

 

    {

 

 

var query = FB.Data.query('SELECT uid FROM page_fan WHERE page_id = 164524456919432 AND uid = 100001762758708');

 

    query.wait(function (rows) {

 

        if (rows.length > 0) { // like found

 

        var msg = "you like it";

        $("#halloA").text(msg);     

 

        }else{

        var msg = "you do not like it";

        $("#halloA").text(msg);   

}

 

    });

 

 

    }

 

   

 

      setInterval(function() {

 

          latestCheckFB();

 

        }, 100);

Link to comment
https://forums.phpfreaks.com/topic/228239-a-query-question/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.