Welcome Guest, Not a member yet? Register   Sign In
how to make create and update in one function??
#1

[eluser]yudahebat[/eluser]
I have a web project n I make it with CI
there is a way to make create n edit in one function??
what is the parameter?? Id?
how we make it?
#2

[eluser]Phil Sturgeon[/eluser]
If you are talking about the Database Active Record library then there is no support for this.

You need to take a look for REPLACE INTO and INSERT ... ON DUPLICATE UPDATE for MySQL. Google will help you on this one.
#3

[eluser]n0xie[/eluser]
You could take a look here:
http://www.phpfour.com/blog/2008/07/exte...deigniter/

It extends the base Model with some extra functions like 'save' which updates a record if it gets an id, and inserts it otherwise (basically what you want).




Theme © iAndrew 2016 - Forum software by © MyBB