Ejemplo n.º 1
0
 function save($input)
 {
     $input = array_map('mysql_escape_string', $input);
     $input = array_map('strip_tags', $input);
     $input = array_map('trim', $input);
     if ($this->id > 0) {
         $sql_type = "UPDATE";
         $sql_end = " WHERE id = " . $this->id;
     } else {
         $sql_type = "INSERT INTO";
         $sql_end = '';
     }
     $db = new DB_Sql();
     $db->query($sql_type . " langtkursus_fag_gruppe\r\n            SET\r\n                show_description = '" . $input['show_description'] . "',\r\n                published='" . $input['published'] . "',\r\n                vis_diplom='" . $input['vis_diplom'] . "',\r\n                valgfag='" . $input['valgfag'] . "',\r\n                navn = '" . $input['navn'] . "', beskrivelse = '" . $input['beskrivelse'] . "'" . $sql_end);
     if ($this->id == 0) {
         $this->id = $db->insertedID();
     }
     return $this->id;
 }