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

[eluser]mflammia[/eluser]
Have taken the update query and written directly into the model:

The query:

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

Re-written it

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

So changed to model fucntion:

Code:
function update_recordP($updateID,$person)
{
                $updateID = (int)$updateID;
                $this->db->query ("UPDATE person SET first_name = 'joe', second_name = 'bloggs', dob = '1972-08-11', phone = '', email = '' WHERE `id_person` = 5");
                //$this->db->where ('id_person',$updateID);
                //$this->db->update('person', $person);
                $str = $this->db->last_query();
                echo $str;
}

When the function is called the updated works perectly!

So I am thinking that although it looks clean the $person array or the $updateID is introducing something that should not be there - is there a codigniter function that could be used to clean it?


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