aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/database.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/database.php')
-rw-r--r--engine/lib/database.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php
index 17857bef6..7288a5f42 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -108,11 +108,12 @@
/**
* Use this function to get data from the database
- * @param $query The query being passed.
+ * @param string $query The query being passed.
+ * @param string $call Optionally, the name of a function to call back to on each row (which takes $row as a single parameter)
* @return array An array of database result objects
*/
- function get_data($query) {
+ function get_data($query, $callback = "") {
global $dbcalls;
@@ -123,6 +124,9 @@
if ($result = mysql_query($query, $dblink)) {
while ($row = mysql_fetch_object($result)) {
+ if (!empty($callback) && is_callable($callback)) {
+ $row = $callback($row);
+ }
$resultarray[] = $row;
}
}