From 05671cf18cfa0eff7757930fda00bdc19f83dbc6 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 9 Oct 2012 04:58:57 +0000 Subject: batch manager - remove unused code, less sql queries and avoid 4 calls to same display_select function git-svn-id: http://piwigo.org/svn/trunk@18573 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/dblayer/functions_mysql.inc.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'include/dblayer') diff --git a/include/dblayer/functions_mysql.inc.php b/include/dblayer/functions_mysql.inc.php index a7655e544..f33d616b0 100644 --- a/include/dblayer/functions_mysql.inc.php +++ b/include/dblayer/functions_mysql.inc.php @@ -189,19 +189,28 @@ function pwg_db_insert_id($table=null, $column='id') * used here * * @param string $query - * @param string $fieldname + * @param string $fieldname optional * @return array */ -function array_from_query($query, $fieldname) +function array_from_query($query, $fieldname=false) { $array = array(); $result = pwg_query($query); - while ($row = mysql_fetch_assoc($result)) + if (false === $fieldname) { - $array[] = $row[$fieldname]; + while ($row = mysql_fetch_assoc($result)) + { + $array[] = $row; + } + } + else + { + while ($row = mysql_fetch_assoc($result)) + { + $array[] = $row[$fieldname]; + } } - return $array; } -- cgit v1.2.3