Welcome Guest, Not a member yet? Register   Sign In
How to fetch the Id of the previously added record
#1

[eluser]skillfullbus[/eluser]
Hi All,
I am making a registration page wherein the data entered by the user would go into two different tables in the database.

Now the second table has User Id as a foreign key to the User table (1st table) primary key which is auto increment.

Now while adding data to the 2nd table I need the primary key of the user table (1st table). How do I get it? Pl help.

Thanks !
#2

[eluser]therealmaloy[/eluser]
@skillfullbus

check this thread.

http://ellislab.com/forums/viewthread/63052/
#3

[eluser]überfuzz[/eluser]
You might even wanna store the id in a the session array. Then if the register id doesn't exists you redirect to the form(start). When the user is registered you unset the session('register_id').
#4

[eluser]jedd[/eluser]
You appear to be asking the second question that's asked (and answered) in the [url="/wiki/FAQ"]FAQ[/url].

Well done you.
#5

[eluser]skillfullbus[/eluser]
Thanks Guys !
#6

[eluser]überfuzz[/eluser]
[quote author="jedd" date="1259874232"]You appear to be asking the second question that's asked (and answered) in the [url="/wiki/FAQ"]FAQ[/url].

Well done you.[/quote]
Nice going, keep it up and soon it'll be nr1. Smile




Theme © iAndrew 2016 - Forum software by © MyBB