Ignore:
Timestamp:
Nov 10, 2013, 6:03:25 PM (10 years ago)
Author:
mistic100
Message:

move array_from_query to functions.inc.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/dblayer/functions_mysqli.inc.php

    r25018 r25427  
    238238 */
    239239
    240 /**
    241  * creates an array based on a query, this function is a very common pattern
    242  * used here
    243  *
    244  * @param string $query
    245  * @param string $fieldname optional
    246  * @return array
    247  */
    248 function array_from_query($query, $fieldname=false)
    249 {
    250   $array = array();
    251 
    252   $result = pwg_query($query);
    253   if (false === $fieldname)
    254   {
    255     while ($row = pwg_db_fetch_assoc($result))
    256     {
    257       $array[] = $row;     
    258     }
    259   }
    260   else
    261   {
    262     while ($row = pwg_db_fetch_assoc($result))
    263     {
    264       $array[] = $row[$fieldname];
    265     }
    266   }
    267   return $array;
    268 }
    269 
    270240define('MASS_UPDATES_SKIP_EMPTY', 1);
    271241/**
Note: See TracChangeset for help on using the changeset viewer.