$query = "SELECT * FROM tbl_mahasiswa ORDER BY nama_mahasiswa ASC"; $dewan1 = $db1->prepare($query); $dewan1->execute(); $res1 = $dewan1->get_result(); while ($row = $res1->fetch_assoc()) { ... }