]> git.mjollnir.org Git - moodle.git/commitdiff
New delete_records_select() function
authormoodler <moodler>
Sun, 27 Apr 2003 06:18:03 +0000 (06:18 +0000)
committermoodler <moodler>
Sun, 27 Apr 2003 06:18:03 +0000 (06:18 +0000)
lib/datalib.php

index 427540f7c8e561b4b8bf35861ce1e2f871d4f695..a7955c8a81acbaeb38e2abeb053d2a60143af85d 100644 (file)
@@ -542,6 +542,19 @@ function delete_records($table, $field1="", $value1="", $field2="", $value2="",
     return $db->Execute("DELETE FROM $CFG->prefix$table $select");
 }
 
+function delete_records_select($table, $select="") {
+/// Delete one or more records from a table
+/// "select" is a fragment of SQL to define the selection criteria
+
+    global $CFG, $db;
+
+    if ($select) {
+        $select = "WHERE $select";
+    }
+
+    return $db->Execute("DELETE FROM $CFG->prefix$table $select");
+}
+
 
 function insert_record($table, $dataobject, $returnid=true) {
 /// Insert a record into a table and return the "id" field if required