Home
Forums
Members
Search
Help
New topics
Todays topics
Website
Welcome Guest, Not a member yet?
Register
Sign In
Login
Username:
Password:
Remember me
Lost Password?
CodeIgniter Forums
Archived Discussions
Archived Development & Programming
Id of last insert
Share on Google
Share on Facebook
Share on Twitter
View a Printable Version
Subscribe to this thread
Add Poll to this thread
Send thread to a friend
Linear Mode
Threaded Mode
Id of last insert
El Forum
Guest
#1
07-09-2009, 12:31 PM
[eluser]sherwoodforest[/eluser]
I tried
$insert_id = $this->db->insert('change',$data);
but all I get back is 1 for the insert_id
what I want is the primary key for the row I just inserted
El Forum
Guest
#2
07-09-2009, 12:41 PM
[eluser]Dam1an[/eluser]
You need to use
Code:
$this->db->insert_id();
after making the query for the ID
(I'm assuming you probably get 1 back meaning success, and 0 would mean it failed?)
El Forum
Guest
#3
07-09-2009, 12:43 PM
[eluser]sherwoodforest[/eluser]
thank you
--------------------
Private Messages
User Control Panel
Who's Online
Search
Forum Home
General
-- News & Discussion
-- Events
-- Lounge
-- Regional User Groups
Using CodeIgniter
-- Installation & Setup
-- Model-View-Controller
-- Libraries & Helpers
-- Best Practices
-- Choosing CodeIgniter
-- General Help
CodeIgniter 4
-- CodeIgniter 4 Roadmap
-- CodeIgniter 4 Development
-- CodeIgniter 4 Feature Requests
-- CodeIgniter 4 Support
-- CodeIgniter 4 Discussion
-- CodeIgniter 4 Addins
Development
-- CodeIgniter 3.x
-- CodeIgniter 2.x
-- Issues
-- NetBeans Plugin
External Resources
-- Spotlight
-- Learn More
-- Jobs
-- Addins
Archived Discussions
-- Archived Libraries & Helpers
-- Archived Development & Programming
Theme © iAndrew 2016 -
Forum software by © MyBB