title: Export comments from fb:comments
body: <p>I'm a little desperate about this. I have a site with a comments box with around 183000 comments that I want to backup. But every time I do an fql.query, I only get 100 items. I had tried:</p>
  
  <pre><code>SELECT xid, object_id, post_id, time, text, id FROM comment WHERE   xid='bdatapoyo' ORDER BY time DESC
  </code></pre>
  
  <p>and after that, using the last "time"</p>
  
  <pre><code>SELECT xid, object_id, post_id, time, text, id FROM comment WHERE   xid='bdatapoyo' AND time &gt;= xxxxxxx ORDER BY time DESC
  </code></pre>
  
  <p>but the latter only gives me one comment..</p>
  
  <p>I made an PHP page with this code, but again, it only grabs 100 items:</p>
  
  <pre><code>&lt;?php        
      require 'php-sdk/src/facebook.php';
  
      $facebook = new Facebook(array(
      'appId'  =&gt; 'XXXXXXXXXX',
      'secret' =&gt; 'XXXXXXXXXX',
      'cookie' =&gt; true,
      ));
  
      $conexion = mysql_connect("localhost", "XXXX", "XXXX");
      mysql_select_db("TVN", $conexion);
  
      $time_old = "1315070888";
      do {
  
          $fql = "SELECT fromid,time,text FROM comment WHERE xid='bdatapoyo' AND time &gt;= " . $time_old . " ORDER BY time";
  
          $response = $facebook-&gt;api(array(
              'method' =&gt; 'fql.query',
              'query' =&gt;$fql,
          ));
  
          foreach($response as $key =&gt; $value) {
              $sql = "INSERT INTO comment (text, uuid, time) VALUES ('" . $value["text"] . "', '" . $value["fromid"] . "', '" . $value["time"] . "')";     
              $result = mysql_query($sql);
          }
  
          $time_old = $response[count($response)-1]["time"];
          print_r($time_old);
      } while (count($response) &gt; 0);
  
      ?&gt;
  </code></pre>