JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
email() takes reply-to parameter, added: db_count()
[wfpl.git] / db.php
diff --git a/db.php b/db.php
index 065ac0e..23c56b5 100644 (file)
--- a/db.php
+++ b/db.php
@@ -130,6 +130,8 @@ function _db_printf($str, $args) {
 
                if($chr == '"') {
                        $out .= '"' . enc_sql(array_pop($args)) . '"';
+               } elseif($chr == 's') {
+                       $out .= enc_sql(array_pop($args));
                } elseif($chr == 'i') {
                        $int = format_int(array_pop($args));
                        if($int == '') $int = '0';
@@ -210,6 +212,10 @@ function db_get_value($table, $columns, $where = '') {
        return $value;
 }
 
+function db_count($table, $where = '') {
+       return db_get_value($table, 'count(*)', $where);
+}
+
 # call either of these ways:
 #
 # db_insert('people', 'name,company', 'jason', 'widgets ltd');