Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql database update and codeigniter rows affected function [duplicate]

I am using this function this codeigniter function after update query

$this->db->affected_rows();

it returns number of rows affected if i update values, but if i update values with the same as previous it retuns 0 rows affected

Any help...

like image 273
h_a86 Avatar asked Jun 13 '26 14:06

h_a86


1 Answers

yes i understand what i need is the confirmation that query has successfully run.

All CI database functions return a result if they "successfully run".

So

$result = $this->db->update('your_table', $data);
if ( ! $result)
{
     // Error
}
{
     // Function ran ok - do whatever
}
like image 135
Laurence Avatar answered Jun 17 '26 09:06

Laurence



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!