Welcome Guest, Not a member yet? Register   Sign In
$this->db->affected_rows() returns -1 after query
#5

[eluser]bleu[/eluser]
[quote author="CroNiX" date="1336412575"]Also, if you are updating, affected_rows() will only return a positive number if the data actually changes. If it doesn't change, the update doesn't actually take place even thought the query is "successful".

So if the data was:
id:21
name:Bill

and you do an update setting the name to 'Bill' for id 21, no update will take place.

One thing you aren't checking, is the result of $update to see whether there was an error or not. It will return TRUE if the query was successfully run and FALSE if there was an error. Check for an error first before checking to see if the update had affected_rows().[/quote]



I have tried running it in phpmyadmin and it gives me the proper 0 or 1 rows affected as per the data.But when i run it through codeigniter I get -1 even when The value to be updated has changed or remained same


The query is true always in codeigniter


Is it because I have turned on codeigniter mysqli drivers


Messages In This Thread
$this->db->affected_rows() returns -1 after query - by El Forum - 05-05-2012, 02:18 AM
$this->db->affected_rows() returns -1 after query - by El Forum - 05-07-2012, 12:23 AM
$this->db->affected_rows() returns -1 after query - by El Forum - 05-07-2012, 10:42 AM
$this->db->affected_rows() returns -1 after query - by El Forum - 05-08-2012, 05:30 AM
$this->db->affected_rows() returns -1 after query - by El Forum - 05-08-2012, 05:36 AM
$this->db->affected_rows() returns -1 after query - by El Forum - 05-08-2012, 06:57 AM
$this->db->affected_rows() returns -1 after query - by El Forum - 05-09-2012, 08:16 AM
$this->db->affected_rows() returns -1 after query - by El Forum - 05-10-2012, 01:35 AM
$this->db->affected_rows() returns -1 after query - by El Forum - 11-17-2013, 06:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB