Codeigniter Update Query

[Solved] Codeigniter Update Query | Php Frameworks Codeigniter - Code Explorer | yomemimo.com
Question : codeigniter where_not_in

Answered by : portapipe

$names = array('Frank', 'Todd', 'James');
$this->db->where_not_in('username', $names);
// Produces: WHERE username NOT IN ('Frank', 'Todd', 'James')

Source : https://codeigniter.com/userguide3/database/query_builder.html | Last Update : Wed, 04 Nov 20

Question : update query in codeigniter using where condition

Answered by : black-bat-xw45nii1k5qb

public function update_row(){	$update_rows = array('field-name' => 'field-data',);	$this->db->where('id', 1 );	$this->db->update('table-name', $update_rows);	}

Source : https://wlearnsmart.com/update-query-in-codeigniter-using-where-condition/ | Last Update : Wed, 22 Jul 20

Question : codeigniter update query return value

Answered by : black-bat-xw45nii1k5qb

public function update_row(){	$update_rows = array(	'name' => 'rincky',	'address' => 'India',	'contact' => '98545785',	'department' => 'IT',	);	$this->db->where('id', 1 );	$result = $this->db->update('user', $update_rows);	return $result;	}

Source : https://wlearnsmart.com/update-query-in-codeigniter-using-where-condition/ | Last Update : Wed, 22 Jul 20

Question : cideigniter orLike()

Answered by : sameh-shahin

$this->db->like('title', 'match'); $this->db->or_like('body', $match);
// WHERE `title` LIKE '%match%' ESCAPE '!' OR `body` LIKE '%match%' ESCAPE '!'

Source : https://codeigniter.com/userguide3/database/query_builder.html | Last Update : Tue, 27 Oct 20

Question : codeigniter select for update

Answered by : portapipe

$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);

Source : | Last Update : Fri, 09 Oct 20

Answers related to codeigniter update query

Code Explorer Popular Question For Php Frameworks Codeigniter