aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-10-12 22:12:58 -0700
committerzotlabs <mike@macgirvin.com>2016-10-12 22:12:58 -0700
commit48026efddfdf063fad7c7bd7a86dd7fc4ca4a0a7 (patch)
tree49455a9983d37f6b9a908be77e6dea4a1b7db0d0 /include/text.php
parente31451000551c879bda7be8a5fbfe4b6457aa918 (diff)
downloadvolse-hubzilla-48026efddfdf063fad7c7bd7a86dd7fc4ca4a0a7.tar.gz
volse-hubzilla-48026efddfdf063fad7c7bd7a86dd7fc4ca4a0a7.tar.bz2
volse-hubzilla-48026efddfdf063fad7c7bd7a86dd7fc4ca4a0a7.zip
consolidate duplicated code for creating table entries from an array
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index 6d5b72f49..f23458db0 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3028,3 +3028,20 @@ function array2XML($obj, $array)
}
}
}
+
+
+function create_table_from_array($table,$arr) {
+
+ if(! ($arr && $table))
+ return false;
+
+ dbesc_array($arr);
+
+ $r = dbq("INSERT INTO " . TQUOT . $table . TQUOT . " (" . TQUOT
+ . implode(TQUOT . ', ' . TQUOT, array_keys($arr))
+ . TQUOT . ") VALUES ('"
+ . implode("', '", array_values($arr))
+ . "')" );
+ return $r;
+
+} \ No newline at end of file