Jan 27, 2022, 02:46 PM

News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.


Paste-1321325648:v:use_geshi-1:v:type-php

Started by SleePy, Nov 15, 2011, 02:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SleePy

      // Get the tracked bugs
      $request = smcFunc::db_query('', '
         SELECT COUNT(DISTINCT t.id_topic)
         FROM {db_prefix}topics AS t
            INNER JOIN main_messages AS m ON (m.id_msg = t.id_first_msg)
         WHERE t.id_board = {int:bugs_board}
            AND m.subject REGEXP({string:regex})',
         array(
            'bugs_board' => 137,
            'regex' => '\[[0-9]{4}\]'
      ));
      list ($tracked) = smcFunc::db_fetch_row($request);
      smcFunc::db_free_result($request);

      // Get the total
      $request = smcFunc::db_query('', '
         SELECT COUNT(id_topic)
         FROM {db_prefix}topics
         WHERE id_board = {int:bugs_board}',
         array(
            'bugs_board' => 137
      ));
      list ($total) = smcFunc::db_fetch_row($request);
      smcFunc::db_free_result($request);

      // Get the locked
      $request = smcFunc::db_query('', '
         SELECT COUNT(id_topic)
         FROM {db_prefix}topics
         WHERE id_board = {int:bugs_board}
            and locked = {int:locked}',
         array(
            'bugs_board' => 137,
            'locked' => 1,
      ));
      list ($locked) = smcFunc::db_fetch_row($request);
      smcFunc::db_free_result($request);
No siggy! :D