Example #1
0
 function Update($table, $params, $where)
 {
     // Turn $params array into a string
     foreach ($params as $field => $value) {
         $valuesArray[] = $field . " = '" . Database::Sanitize($value) . "'";
     }
     $values = implode(', ', $valuesArray);
     // Turn $where into a string (if it isn't already)
     $where = Database::GetWhereString($where);
     $query = 'UPDATE ' . $table . ' SET ' . $values . ' WHERE ' . $where;
     if (Database::Query($query)) {
         return true;
     } else {
         return false;
     }
 }