$awam=mysqli_query($conn,"SELECT data_pajak.idpajak, data_pajak.idbank, data_pajak.id_jual, data_pajak.kodepajak, data_pajak.namapajak, data_pajak.persentase, data_pajak.persentase, data_pajak.keteranganpajak, data_pajak.userID, akun_jual.id_jual, akun_jual.nama, data_bank.idbank, data_bank.namabank FROM data_bank INNER JOIN (akun_jual INNER JOIN data_pajak ON akun_jual.id_jual = data_pajak.id_jual) ON data_bank.idbank = data_pajak.idbank"); while ($ab = mysqli_fetch_array($awam)) { if ($idbank == $ab['idbank']) { echo '<option value="'.$ab['idbank'].'" selected>'.$ab['namabank'].'</option>'; } else { echo '<option value="'.$ab['idbank'].'">'.$ab['namabank'].'</option>'; } }