Update or insert if record exits in table or not |
[eluser]mflammia[/eluser]
Hi, Not sure if I am going about this correctly but within my model I have the following: Code: function get_person(){ Within my controller I have: Code: function get_records_edit(){ and in my view I have something like: Code: <div> The person and address are different tables and the idea is two fold in that I test the data in the table exits, if so, output it in the value. And also that I want to be able to do an edit from this view, so I need to tell my controller / model as to whether to update or insert a record depending on whether date already exits or not. I was thinking of going about this by creating an update function that uses the Code: $data['personSet'] values created within the controller get_records_edit function. I'm stuck because I don't not only know how to call these values from another function / method within the controller when the update function is called or whether this is the right way to go about it? Thanks in advance for any pointers / help.
[eluser]Denzel[/eluser]
Check out this article. I don't think CodeIgniter supports this kind of query out of the box with Active Records, but you could definitely build the query yourself. |
Welcome Guest, Not a member yet? Register Sign In |