Code Comments
Programming Forum and web based access to our favorite programming groups.I have a table like so:
id -> auto increment
name -> name
After I insert a new name
insert into mytable values('','Bob');
I need Bob's id returned.
Post Follow-up to this messageOn Wed, 27 Oct 2004, Michael Gargiullo wrote:
> I have a table like so:
>
> id -> auto increment
> name -> name
>
> After I insert a new name
> insert into mytable values('','Bob');
>
> I need Bob's id returned.
Hey, wait -- you could write a program to do that, couldn't you!
And reading `perldoc DBD::mysql` would totally show you how!
(Hint -- search in the perldoc for 'insertid'.)
--
Chris Devers
Post Follow-up to this messageOn Wed, 2004-10-27 at 15:42, Chris Devers wrote: > On Wed, 27 Oct 2004, Michael Gargiullo wrote: > > > Hey, wait -- you could write a program to do that, couldn't you! > > And reading `perldoc DBD::mysql` would totally show you how! > > (Hint -- search in the perldoc for 'insertid'.) > Thanks Chris, I was using the PHP function instead of perl's...
Post Follow-up to this messageOn Wed, 27 Oct 2004, Michael Gargiullo wrote: > On Wed, 2004-10-27 at 15:42, Chris Devers wrote: > > Thanks Chris, > > I was using the PHP function instead of perl's... You did look it up, right? I deliberately gave only part of the string you need to use... -- Chris Devers
Post Follow-up to this messageOn Wed, 2004-10-27 at 16:16, Chris Devers wrote:
> On Wed, 27 Oct 2004, Michael Gargiullo wrote:
>
>
> You did look it up, right?
>
> I deliberately gave only part of the string you need to use...
>
Yup... $id=$dbh->{'mysql_insertid'}; Worked like a charm.
Post Follow-up to this messageOn Wed, 27 Oct 2004, Michael Gargiullo wrote:
> On Wed, 2004-10-27 at 16:16, Chris Devers wrote:
>
> Yup... $id=$dbh->{'mysql_insertid'}; Worked like a charm.
Good -- now you know how to find future answers :-)
--
Chris Devers
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.