aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2014-02-13 22:21:12 +0000
committerrvelices <rv-github@modusoptimus.com>2014-02-13 22:21:12 +0000
commit2b81fbc4aa00ab4fcef794083c3f8e2d6bfe314e (patch)
tree08dae87951f3b196063d30fbae5b1fb12c441c87 /include/functions.inc.php
parentd0733822cebce4c1314ee3e70e4e5ce84df98640 (diff)
more query2array
git-svn-id: http://piwigo.org/svn/trunk@27369 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r--include/functions.inc.php32
1 files changed, 4 insertions, 28 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index d163a2725..d81d62727 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -1253,15 +1253,7 @@ function prepend_append_array_items($array, $prepend_str, $append_str)
*/
function simple_hash_from_query($query, $keyname, $valuename)
{
- $array = array();
-
- $result = pwg_query($query);
- while ($row = pwg_db_fetch_assoc($result))
- {
- $array[ $row[$keyname] ] = $row[$valuename];
- }
-
- return $array;
+ return query2array($query, $keyname, $valuename);
}
/**
@@ -1275,13 +1267,7 @@ function simple_hash_from_query($query, $keyname, $valuename)
*/
function hash_from_query($query, $keyname)
{
- $array = array();
- $result = pwg_query($query);
- while ($row = pwg_db_fetch_assoc($result))
- {
- $array[ $row[$keyname] ] = $row;
- }
- return $array;
+ return query2array($query, $keyname);
}
/**
@@ -1296,24 +1282,14 @@ function hash_from_query($query, $keyname)
*/
function array_from_query($query, $fieldname=false)
{
- $array = array();
-
- $result = pwg_query($query);
if (false === $fieldname)
{
- while ($row = pwg_db_fetch_assoc($result))
- {
- $array[] = $row;
- }
+ return query2array($query);
}
else
{
- while ($row = pwg_db_fetch_assoc($result))
- {
- $array[] = $row[$fieldname];
- }
+ return query2array($query, null, $fieldname);
}
- return $array;
}
/**