aboutsummaryrefslogtreecommitdiffstats
path: root/include/dblayer
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2012-10-09 04:58:57 +0000
committerrvelices <rv-github@modusoptimus.com>2012-10-09 04:58:57 +0000
commit05671cf18cfa0eff7757930fda00bdc19f83dbc6 (patch)
tree30d30ff4ad6862ac23db7f3320922303073bc752 /include/dblayer
parent4c03bc9260bda368950e143e5a9861c8eaf664b5 (diff)
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
Diffstat (limited to 'include/dblayer')
-rw-r--r--include/dblayer/functions_mysql.inc.php19
1 files changed, 14 insertions, 5 deletions
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;
}