aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-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;
}