Welcome Guest, Not a member yet? Register   Sign In
update setting all fields to zero
#1

[eluser]mflammia[/eluser]
Hi,

When updating a record using the code below it seems to replace all items with a 0?

Code:
function update_recordP($updateID,$person)
{
  $this->db->where ('id_person',$updateID);
                $this->db->update('person', $person);
                $str = $this->db->last_query();
                echo $str;
  return;
}

The echo $str looks like the following:

Code:
UPDATE `person` SET `first_name` = 'Joe', `second_name` = 'Bloggs', `dob` = '1972-08-11', `phone` = '', `email` = '' WHERE `id_person` = '5'

Code:
+-------------+-------------+------+-----+---------+----------------+
| Field       | Type        | Null | Key | Default | Extra          |
+-------------+-------------+------+-----+---------+----------------+
| id_person   | int(11)     | NO   | PRI | NULL    | auto_increment |
| first_name  | varchar(50) | YES  |     | NULL    |                |
| second_name | varchar(50) | YES  |     | NULL    |                |
| dob         | date        | NO   |     | NULL    |                |
| email       | varchar(80) | YES  |     | NULL    |                |
| phone       | varchar(20) | YES  |     | NULL    |                |
+-------------+-------------+------+-----+---------+----------------+

Regardless of whats in the table, whether some fields have entries or are blank the update sets them all to zero's?

Any ideas?


Messages In This Thread
update setting all fields to zero - by El Forum - 04-12-2012, 01:16 AM
update setting all fields to zero - by El Forum - 04-12-2012, 01:24 AM
update setting all fields to zero - by El Forum - 04-12-2012, 01:48 AM
update setting all fields to zero - by El Forum - 04-12-2012, 04:38 AM
update setting all fields to zero - by El Forum - 04-12-2012, 09:30 AM
update setting all fields to zero - by El Forum - 04-12-2012, 10:46 AM
update setting all fields to zero - by El Forum - 04-12-2012, 10:50 AM
update setting all fields to zero - by El Forum - 04-12-2012, 10:56 AM
update setting all fields to zero - by El Forum - 04-13-2012, 01:07 PM
update setting all fields to zero - by El Forum - 04-13-2012, 01:18 PM
update setting all fields to zero - by El Forum - 04-13-2012, 01:31 PM
update setting all fields to zero - by El Forum - 04-13-2012, 01:33 PM
update setting all fields to zero - by El Forum - 04-13-2012, 01:45 PM
update setting all fields to zero - by El Forum - 04-13-2012, 02:27 PM
update setting all fields to zero - by El Forum - 04-13-2012, 04:02 PM
update setting all fields to zero - by El Forum - 04-15-2012, 04:09 AM
update setting all fields to zero - by El Forum - 04-15-2012, 03:17 PM
update setting all fields to zero - by El Forum - 04-16-2012, 09:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB