Answers for "codeigniter 4 update"

PHP
0

codeigniter update

$data = [
        'title' => $title,
        'name'  => $name,
        'date'  => $date
];

$builder->where('id', $id);
$builder->update($data);
// Produces:
//
//      UPDATE mytable
//      SET title = '{$title}', name = '{$name}', date = '{$date}'
//      WHERE id = $id
Posted by: Guest on December-30-2020
0

codeigniter update or create

$this->db->where('user_id',$id);
   $q = $this->db->get('profile');

   if ( $q->num_rows() > 0 ) 
   {
      $this->db->where('user_id',$id);
      $this->db->update('profile',$data);
   } else {
      $this->db->set('user_id', $id);
      $this->db->insert('profile',$data);
   }
Posted by: Guest on September-08-2021
0

codeigniter 3 update

$data = array(
        'title' => $title,
        'name' => $name,
        'date' => $date
);

$this->db->where('id', $id);
$this->db->update('mytable', $data);
Posted by: Guest on November-06-2020
-1

codeigniter 4 query builder select

$builder->select('title, content, date');
$query = $builder->get();

// Executes: SELECT title, content, date FROM mytable
Posted by: Guest on December-16-2020

Browse Popular Code Answers by Language