예제 #1
0
 public function ambilSiswa($nomorSiswa)
 {
     $ps = $this->connection->prepare("SELECT * FROM siswa WHERE nomor_siswa=:nomorSiswa");
     $ps->bindParam(":nomorSiswa", $nomorSiswa);
     $ps->execute();
     $rs = $ps->fetchAll();
     foreach ($rs as $s) {
         $siswa = new Siswa();
         $siswa->setNomorSiswa($s["nomor_siswa"]);
         $siswa->setNama($s['nama']);
         $siswa->getKelas()->setIdKelas($s["id_kelas"]);
         return $siswa;
     }
 }