News:

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

Main Menu

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

Started by SleePy, Jun 18, 2008, 08:35 PM

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

SleePy

// Provide a way to do results with offsets
fucntion convert_result($request, $offset = 0, $field_name = '')
{
   global $smcFunc;

   // SQLite is a pain, This should hopefully work.
   if ($smcFunc['db_title'] == 'SQLite')
   {
      $result = $smcFunc['db_query']('', $request, 'security_override');

      $t = 0;

      while ($row = sqlite_fetch_array($result))
      {
         if ($t != $offset)
            ++$t;
         elseif ($field_name != '')
            return $row[$field_name];
         else
            return $row[0];
      }   
   }
   // Luckily Postgresql is with it.
   elseif ($smcFunc['db_title'] == 'PostgreSQL')
      return pg_fetch_result($request, $offset, $field_name);
   else
      return mysql_fetch($request, $offset, $field_name);
}
No siggy! :D

SleePy

// Provide a way to do results with offsets
fucntion convert_result($request, $offset = 0, $field_name = '')
{
   global $smcFunc;

   // SQLite is a pain, This should hopefully work.
   if ($smcFunc['db_title'] == 'SQLite')
   {
      // Perform the query.
      $result = $smcFunc['db_query']('', $request, 'security_override');

      // Now loop throuh it with an array (for ease of use for field_name).
      $t = 0;
      while ($row = sqlite_fetch_array($result))
      {
         // If its not our offset, Add, and get on with it.
         if ($t != $offset)
         {
            ++$t;
            continue;
         }

         // We want to be that lazy.. Um I mean, Specific?
         if ($field_name != '')
            return $row[$field_name];
         else
            return $row[0];
      }   
   }
   // Luckily Postgresql is with it.
   elseif ($smcFunc['db_title'] == 'PostgreSQL')
      return pg_fetch_result($request, $offset, $field_name);
   else
      return mysql_fetch($request, $offset, $field_name);
}
No siggy! :D

SleePy

// Provide a way to do results with offsets
fucntion convert_result($request, $offset = 0, $field_name = '')
{
   global $smcFunc;

   // SQLite is a pain, This should hopefully work.
   if ($smcFunc['db_title'] == 'SQLite')
   {
      // Perform the query.
      $result = $smcFunc['db_query']('', $request, 'security_override');

      // Now loop throuh it with an array (for ease of use for field_name).
      $t = 0;
      while ($row = sqlite_fetch_array($result))
      {
         // If its not our offset, Add, and get on with it.
         if ($t != $offset)
         {
            ++$t;
            continue;
         }

         // We want to be that lazy.. Um I mean, Specific?
         if ($field_name != '')
            return $row[$field_name];
         else
            return $row[0];
      }   
   }
   // Luckily Postgresql is with it.
   elseif ($smcFunc['db_title'] == 'PostgreSQL')
      return pg_fetch_result($request, $offset, $field_name);
   else
      return mysql_result($request, $offset, $field_name);
}
No siggy! :D