Havn't you read this? http://www.web2py.com/examples/default/dal

On Apr23, 9:21am, waTR <roman.proje...@gmail.com> wrote:
> I am trying to have a controller insert a db record, and then update
> the same record. However, in order to update the record just created
> by a user session, I need to use the db record's id number. The
> problem is, I don't know how to get the id number from the record just
> created by a user session.
>
> Help?
>
> Here is the pseudo code:
>
> db.db_users.insert( dbu_name=request.vars.nick,
>                             dbu_email=request.vars.email,
>                             dbu_password=request.vars.pass1,
>                             dbu_city=request.vars.city,
>                             dbu_referral=request.vars.referral)
>
> db(db.db_users.id==USERID_FROM_RECORD_ABOVE).select()[0].update_record
> (\
>                                 dbu_name=request.vars.nick,\
>                                 dbu_email=request.vars.email,\
>                                 dbu_password=request.vars.pass1,\
>                                 dbu_city=request.vars.city,\
>                                 dbu_referral=request.vars.referral)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to