SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PostgreSQL Last Insert ID?

    I just started using PostgreSQL ( have experience in MySQL ) and I just noticed there isn't a function within PHP that will allow you to grab the last insert id. Can anyone here give some pointers?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    SELECT MAX(id) AS 'maxId' FROM tableName

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wouldn't recommend using that approach.

    Read about sequences in PostgreSQL.

    Also, see the same question asked elsewhere.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •