Getting MySQL Generated Keys

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • thehuby

    Getting MySQL Generated Keys

    Hi,

    I am a Java/JSP developer by trade but am currently developing a
    MySQL/PHP solution.

    In JSP when I run an INSERT statement on the db I am able to
    automatically get back a list of any generated keys (without having to
    do some sort of subsequent query to get the information).

    Is there a PHP equivilent of this?

    Thanks

  • Chris Hope

    #2
    Re: Getting MySQL Generated Keys

    thehuby wrote:
    [color=blue]
    > I am a Java/JSP developer by trade but am currently developing a
    > MySQL/PHP solution.
    >
    > In JSP when I run an INSERT statement on the db I am able to
    > automatically get back a list of any generated keys (without having to
    > do some sort of subsequent query to get the information).
    >
    > Is there a PHP equivilent of this?[/color]

    Unfortunately, as with all built in PHP database functions, there's no
    database abstraction layer built into PHP which will do it for any
    database, but for mysql you can use the mysql_insert_id () function.



    --
    Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

    Comment

    • thehuby

      #3
      Re: Getting MySQL Generated Keys

      Cheers Chris that worked a treat!

      Rick
      <a href='http://www.e-connected.com'> Accessible Web Design by
      eConnected</a>

      Comment

      Working...