aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r--include/functions.inc.php21
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;
+}
?>