php - how to get a specific array in codeigniter's active record -


for example if have bunch of data stored in active record so

model

 function get_cdj($id){     return $this->db->select()->from("news_dj")->where("news_id",$id)->get();        } 

controller

 public function news_edit($id) {     $data['cdj'] = $this->newscms_model->get_cdj($id);     $data['id'] = $id;     $this->load->vars($data);     $this->load->view('admin/news_edit'); } 

and variable want print is...

$cdj->id 

and want third variable inside it

is there way make similar -

$data[3] 

?


is there way control row want print using codeigniter's active record?

just php's native

 <?php echo $data['insert row number want here']; ?>  ie: $data[3] 

thanks

you can this

model

function get_cdj($id) {     $this->db->select('*');     $this->db->where("news_id",$id);     return $this->db->get("news_dj")->row(); } 

controller

public function news_edit($id) {     $data['cdj'] = $this->newscms_model->get_cdj($id);     $this->load->view('admin/news_edit',$data); } 

news_edit (view) can access content this

echo $cdj->dbfieldname; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -