Ignore:
Timestamp:
Oct 9, 2012, 6:58:57 AM (12 years ago)
Author:
rvelices
Message:

batch manager - remove unused code, less sql queries and avoid 4 calls to same display_select function

File:
1 edited

Legend:

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

    r13843 r18573  
    190190 *
    191191 * @param string $query
    192  * @param string $fieldname
     192 * @param string $fieldname optional
    193193 * @return array
    194194 */
    195 function array_from_query($query, $fieldname)
     195function array_from_query($query, $fieldname=false)
    196196{
    197197  $array = array();
    198198
    199199  $result = pwg_query($query);
    200   while ($row = mysql_fetch_assoc($result))
    201   {
    202     $array[] = $row[$fieldname];
    203   }
    204 
     200  if (false === $fieldname)
     201  {
     202    while ($row = mysql_fetch_assoc($result))
     203    {
     204      $array[] = $row;     
     205    }
     206  }
     207  else
     208  {
     209    while ($row = mysql_fetch_assoc($result))
     210    {
     211      $array[] = $row[$fieldname];
     212    }
     213  }
    205214  return $array;
    206215}
Note: See TracChangeset for help on using the changeset viewer.