[eluser]andes[/eluser]
hi,
I am having trouble running a conditional if statement after running a database query. I want to match user input to existing records in a database, here is my code:
in the controller file
Code:
function create()
{
$data = array(
'gate' => $this->input->post('gate'),
'door' => $this->input->post('door')
);
$this->lex_model->add_records($data);
$this->load->helper('array');
$text1= element('gate', $data);
$text2= element('door', $data);
$tex = $text1;
$tran = $text2;
$goat['cow'] = $this->lex_model->shoeing($tex, $tran);
if($data == $goat)
{
echo 'this is working';
}
else
{
echo 'this is NOT working';
}
}
in the model file
Code:
function shoeing($tex, $tran)
{
$query = $this->db->query("SELECT * FROM ques WHERE gate = '$tex'");
return $query->result_array();
}
Quote:the if($data == $goat) statement just doesn't seem to work. Can somebody please help with this, i can't seem to figure it out