diff options
author | plegall <plg@piwigo.org> | 2005-03-25 22:10:55 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2005-03-25 22:10:55 +0000 |
commit | ef080278bf4d0e073daa5f6a6f6d3b8ae4c29d9c (patch) | |
tree | 243d94d5b810325c43ea9e6998b7929319bc1e3e /include/functions.inc.php | |
parent | 333d44c398e31dd7f24efbcf50d53c1ce2a754ba (diff) |
- new feature : caddie. The purpose is batch management, especially
concerning elements to categories associations. This is the very first
release, needs many improvements.
- new function : array_from_query. Firstly used by "caddie" feature, it may
be useful in many cases.
git-svn-id: http://piwigo.org/svn/trunk@755 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r-- | include/functions.inc.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index edc9f2062..282c196ac 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -618,4 +618,25 @@ function my_error($header) $error.= '</pre>'; die ($error); } + +/** + * creates an array based on a query, this function is a very common pattern + * used here + * + * @param string $query + * @param string $fieldname + * @return array + */ +function array_from_query($query, $fieldname) +{ + $array = array(); + + $result = pwg_query($query); + while ($row = mysql_fetch_array($result)) + { + array_push($array, $row[$fieldname]); + } + + return $array; +} ?> |