コード例 #1
0
ファイル: composers.php プロジェクト: Nosferius/RepMan
 public function fetch()
 {
     $sql = 'SELECT * FROM Composers';
     $return = [];
     // uiteindelijk resultaat zoiets als 'SELECT $scope FROM $table WHERE $choice <optional> AND $choice2 </optional> etc.
     foreach ($this->con->query($sql) as $row) {
         $composer = new composers();
         $composer->setId($row["ID"]);
         $composer->setComposerLastname($row["ComposerLastname"]);
         $composer->setComposerFirstname($row["ComposerFirstname"]);
         $composer->setDateOfBirth($row["DateOfBirth"]);
         $composer->setPlaceOfBirth($row["PlaceOfBirth"]);
         $composer->setBirthCountry($row["BirthCountry"]);
         $composer->setDeceased($row["Deceased"]);
         $return[] = $composer;
         /*
         print $row['ID'] . "\t";
         print $row['ComposerFirstname'] . "\t";
         print $row['ComposerLastname'] . "\t";
         print $row['DateOfBirth'] . "\t";
         print $row['PlaceOfBirth'] . "\t";
         print $row['BirthCountry'] . "\t";
         print $row['Deceased'] . "\n";
         */
     }
     return $return;
 }
コード例 #2
0
ファイル: postHandler.php プロジェクト: Nosferius/RepMan
 public function run()
 {
     if (!isset($_POST["action"])) {
         return;
     }
     if ($_POST["action"] == "addComposer") {
         $composer = new composers();
         $composer->setComposerFirstname($_POST["ComposerFirstname"]);
         $composer->setComposerLastname($_POST["ComposerLastname"]);
         $composer->setDateOfBirth($_POST["DateOfBirth"]);
         $composer->setPlaceOfBirth($_POST["PlaceOfBirth"]);
         $composer->setBirthCountry($_POST["BirthCountry"]);
         $composer->setDeceased($_POST["Deceased"]);
         $composer->add();
     } elseif ($_POST["action"] == "updateComposer") {
         $composer = new composers();
         $composer->setComposerFirstname($_POST["ComposerFirstname"]);
         $composer->setComposerLastname($_POST["ComposerLastname"]);
         $composer->setDateOfBirth($_POST["DateOfBirth"]);
         $composer->setPlaceOfBirth($_POST["PlaceOfBirth"]);
         $composer->setBirthCountry($_POST["BirthCountry"]);
         $composer->setDeceased($_POST["Deceased"]);
         $composer->setID($_POST["id"]);
         $composer->update();
     } elseif ($_POST["action"] == "addSong") {
         $song = new Songs();
         $song->setComposersID($_POST["ComposersID"]);
         $song->setMusicalForm($_POST["MusicalForm"]);
         $song->setTitle($_POST["Title"]);
         $song->setOpus($_POST["Opus"]);
         $song->setMovement($_POST["Movement"]);
         $song->setLength($_POST["Length"]);
         $song->setDifficulty($_POST["Difficulty"]);
         $song->setWantToPlay($_POST["WantToPlay"]);
         $song->setConcertReady($_POST["ConcertReady"]);
         $song->add();
     } elseif ($_POST["action"] == "updateSong") {
         $song = new Songs();
         $song->setComposersID($_POST["ComposersID"]);
         $song->setMusicalForm($_POST["MusicalForm"]);
         $song->setTitle($_POST["Title"]);
         $song->setOpus($_POST["Opus"]);
         $song->setMovement($_POST["Movement"]);
         $song->setLength($_POST["Length"]);
         $song->setDifficulty($_POST["Difficulty"]);
         $song->setWantToPlay($_POST["WantToPlay"]);
         $song->setConcertReady($_POST["ConcertReady"]);
         $song->setID($_POST["id"]);
         $song->update();
     }
 }