public function save() { if (empty($this->id)) { $sql = "INSERT INTO semester(year, semester_order, tuition_start, tuition_end, exam_start, exam_reparat_start, exam_end)\n\t\t\t VALUES (\$1, \$2, "; $sql .= DateConvert::SKtoDB("\$3") . ","; $sql .= DateConvert::SKtoDB("\$4") . ","; $sql .= DateConvert::SKtoDB("\$5") . ","; $sql .= DateConvert::SKtoDB("\$6") . ","; $sql .= DateConvert::SKtoDB("\$7") . ")"; $this->dbh->query($sql, array($this->rok, $this->semester, $this->zac_uc, $this->kon_uc, $this->zac_skus, $this->zac_opr, $this->kon_skus)); } else { $sql = "UPDATE semester\n SET year=\$1, \n semester_order=\$2, \n tuition_start=" . DateConvert::SKtoDB("\$3") . ",\n tuition_end=" . DateConvert::SKtoDB("\$4") . ",\n exam_start=" . DateConvert::SKtoDB("\$5") . ", \n exam_reparat_start=" . DateConvert::SKtoDB("\$6") . ", \n exam_end=" . DateConvert::SKtoDB("\$7") . "\n WHERE id=\$8"; $this->dbh->query($sql, array($this->rok, $this->semester, $this->zac_uc, $this->kon_uc, $this->zac_skus, $this->zac_opr, $this->kon_skus, $this->id)); } }
public function save() { if (empty($this->id)) { $sql = "INSERT INTO semester(rok, semester, zac_uc, kon_uc, zac_skus, zac_opr, kon_skus)\n\t\t\t VALUES (\$1, \$2, "; $sql .= DateConvert::SKtoDB("\$3") . ","; $sql .= DateConvert::SKtoDB("\$4") . ","; $sql .= DateConvert::SKtoDB("\$5") . ","; $sql .= DateConvert::SKtoDB("\$6") . ","; $sql .= DateConvert::SKtoDB("\$7") . ")"; $this->dbh->query($sql, array($this->rok, $this->semester, $this->zac_uc, $this->kon_uc, $this->zac_skus, $this->zac_opr, $this->kon_skus)); } else { $sql = "UPDATE semester\n SET rok=\$1, \n semester=\$2, \n zac_uc=" . DateConvert::SKtoDB("\$3") . ",\n kon_uc=" . DateConvert::SKtoDB("\$4") . ",\n zac_skus=" . DateConvert::SKtoDB("\$5") . ", \n zac_opr=" . DateConvert::SKtoDB("\$6") . ", \n kon_skus=" . DateConvert::SKtoDB("\$7") . "\n WHERE id=\$8"; $this->dbh->query($sql, array($this->rok, $this->semester, $this->zac_uc, $this->kon_uc, $this->zac_skus, $this->zac_opr, $this->kon_skus, $this->id)); } }