Answers for "insert data array codeigniter"

0

insert array values in database using codeigniter

$inputdata=$this->input->post();

$phone=array($inputdata['phone']);
       
       foreach($phone as $arr)
       {
           $phoneNo=$arr;

           $f=count($phoneNo);
           
           for($i=0;$i<$f;$i++)
           {
              $arre=[
                  'phone'=>$phoneNo[$i],
                     ]; 
                  
              $insertB= $this->user_model->userdata($arre);      
           }
       }
Posted by: Guest on June-16-2021
-2

codeigniter select for update

$table = "my_table";
$id = 1;
$update = ["status"=>"working"];
//Edit just above / if you don't need extra "where" clause
$query = $this->db->select()
            ->from($table)
            ->where('id', $id)
            ->get_compiled_select();
$data = $this->db->query("$query FOR UPDATE")->row_array();
$this->db->where('id', $data['id'])->update($table,$update);
Posted by: Guest on October-02-2020

Browse Popular Code Answers by Language