I need help for the query in my model, I want to find the field with variable that i'm input to the controller and as for right now the problem is that the field won't read my variable so here is the code
Controller
public function tampil_soal(){
$kode_soal = $this->input->post('kode_soal');
$where = array('kode_soal' => $kode_soal);
$data['tampilan']= $this->m_model->tampil_soal($kode_soal)->result();
$this->load->view('soal_tampil',$data);
}
Model
public function tampil_soal($where){
return $this->db->query("select * from soal where kode_soal='$where' ORDER BY RAND()");
}
View
<form action="<?php echo base_url()?>siswa/tampil_soal" method="post" class="form">
<input class="input" name="kode_ujian" placeholder="Kode ujian"/>
<input class="button" type="submit" name="submit" value="Selesai"/>
</form>
$whereas an array, while you are not using the key's value for using it as a column inWherecondition$kode_soaland make sure that it gets the value to the controller but the problem is probably in the model? @MadhurBhaiya what do you mean that is open to SQL injection? is like get easily hacked or something?