Any body can help me? I using MVC. This is my model code:
function activatedNode($node_id){ //to activated selected node
$data = array (
'active' => 1
);
$this->db-> where ('node_id', "'.$node_id.'"); //here is error line
$this->db-> update ('node',$data);
}
This is my controller code:
function resultRuang(){
$ruang = $this-> input -> post('ruang');
$node = $this->search3d -> ambilNodeID($ruang);
$this->search3d -> nonactivatedNode();
$this->search3d -> activatedNode($node);
$data['ruang'] = $this->search3d-> resultRuang ();
$data['menu_aktif']= 'ruang';
$data['halaman']= "halaman/resultRuang";
$this->load->view('template/search_view',$data);
}
This is View code:
<?php
echo form_open('mainSearch/resultRuang');
echo 'Ruang yang dipilih :';
echo $ruang -> node_id; //this is also error
echo '<a href= "'.base_url().'index.php/mainSearch/searchRuang"> <button name="name" type="button">Back</button></a>';
echo form_close();
?>
For the first error, you can do this
$this->db->where('node_id', $node_id);
And for the second you need to var_dump($ruang);
and see if $ruang->node_id
even exists.
Also, showing what errors you get might help. Read the Stack Overflow FAQ before you post another question.
In your controller the:
$this->search3d -> activatedNode($node); //incorrect
should be
$this->search3d -> activatedNode($node_id);//correct
because in your model the function activatedNode($node_id) $node_id doesn't really exist in your function that's why it return false