plugins/nuggie/planet.php
changeset 10 219a0133622e
parent 8 160f1170aa32
child 13 421242ebbece
equal deleted inserted replaced
9:8dc58f08a066 10:219a0133622e
   103   $q = $db->sql_query($sql);
   103   $q = $db->sql_query($sql);
   104   if ( !$q )
   104   if ( !$q )
   105     $db->_die();
   105     $db->_die();
   106   
   106   
   107   $count = $db->numrows();
   107   $count = $db->numrows();
       
   108   
   108   $db->free_result($sql);
   109   $db->free_result($sql);
   109   
   110   
   110   // pass 2: production run
   111   // pass 2: production run
   111   $columns = 'p.post_id, p.post_title, p.post_title_clean, p.post_author, p.post_timestamp, p.post_text, b.blog_name, b.blog_subtitle, b.blog_type, b.allowed_users, u.username, u.user_level, COUNT(c.comment_id) AS num_comments, \'' . $db->escape($planet_id) . '\' AS referring_planet';
   112   $columns = 'p.post_id, p.post_title, p.post_title_clean, p.post_author, p.post_timestamp, p.post_text, b.blog_name, b.blog_subtitle, b.blog_type, b.allowed_users, u.username, u.user_level, COUNT(c.comment_id) AS num_comments, \'' . $db->escape($planet_id) . '\' AS referring_planet';
   112   $sql = str_replace('<columns>', $columns, $sql_base);
   113   $sql = str_replace('<columns>', $columns, $sql_base);
   113   $sql = str_replace('<limit>', "LIMIT $offset, 10", $sql);
   114   $sql = str_replace('<limit>', "LIMIT $offset, 10", $sql);
   114   
   115   
   115   // yea. that was one query.
   116   // yea. that was one query.
   116   $q = $db->sql_unbuffered_query($sql);
   117   $q = $db->sql_query($sql);
   117   if ( !$q )
   118   if ( !$q )
   118     $db->_die();
   119     $db->_die();
   119   
   120   
   120   // just let the paginator do the rest
   121   // just let the paginator do the rest
   121   $postbit = new NuggiePostbit();
   122   $postbit = new NuggiePostbit();