javascript - How to save and display values from modal to view by database using codeigniter -


i new codeigniter , cant seem hold of problem, in short having problem understanding flow of data among codeigniter framework. want display data taken database using modals , display them in view..

the code in controller is:

$unitdata =$this->clientunit->getblockunits($client_block_id); foreach ($unitdata->result() $row){   ($i=0; $i < 3; $i++) {      $client_unit_name[$i] = $row->client_unit_name[$i];      $unit_owner_name[$i] = $row->unit_owner_name[$i];          }  }  $data['client_unit_name'] = $client_unit_name;  $data['unit_owner_name'] = $unit_owner_name;  $this->load->view('newblock_unit',$data); 

my modal file is:

function getblockunits($client_block_id) {   $query = $this->db->query('select * client_units client_block_id="'.$client_block_id.'"');   return $query;  } 

as can see, modal , controller code, problem because of multiple rows returned, getting last row in outputs of view, not individual rows...

i think problem not returning object or array. in model should use, object:

return $query->result(); 

or array:

return $query->result_array(); 

edit: can read here http://ellislab.com/codeigniter/user-guide/database/results.html


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -