mysql: last_updated_id

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

    mysql: last_updated_id

    Does it exits a mysql or PHP function to know the last updated id record ?
    When you perform an insert you can know the last inserted ID. In my case I'd
    like the same with the last updated. I'm trying to avoid to do a new query.

    It's there any possibility ?

    Bob


  • Chris Hope

    #2
    Re: mysql: last_updated_id

    Bob Bedford wrote:
    [color=blue]
    > Does it exits a mysql or PHP function to know the last updated id
    > record ? When you perform an insert you can know the last inserted ID.
    > In my case I'd like the same with the last updated. I'm trying to
    > avoid to do a new query.[/color]

    mysql: select last_insert_id( )
    php: mysql_insert_id () http://www.php.net/mysql_insert_id

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

    Comment

    • Chris Hope

      #3
      Re: mysql: last_updated_id

      Chris Hope wrote:
      [color=blue]
      > Bob Bedford wrote:
      >[color=green]
      >> Does it exits a mysql or PHP function to know the last updated id
      >> record ? When you perform an insert you can know the last inserted
      >> ID. In my case I'd like the same with the last updated. I'm trying to
      >> avoid to do a new query.[/color]
      >
      > mysql: select last_insert_id( )
      > php: mysql_insert_id () http://www.php.net/mysql_insert_id[/color]

      Now I realise I didn't read your post correctly and answered your
      question wrong :)

      If you just updated a record then surely you know the id of the record
      you updated already? ie in the query "update sometable set somecolumn =
      somevalue where keyfield = anothervalue" then the updated id is
      'anothervalue'

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

      Comment

      • Bob Bedford

        #4
        Re: mysql: last_updated_id

        > If you just updated a record then surely you know the id of the record[color=blue]
        > you updated already? ie in the query "update sometable set somecolumn =
        > somevalue where keyfield = anothervalue" then the updated id is
        > 'anothervalue'[/color]

        Hem..sounds you are kidding, but:

        update sometable set somecolumn = somevalue where idarticle = 1500 and
        lastdate > now()

        sometable.
        idrecord, idarticle,lastd ate....

        I don't know the idrecord when updating.


        Comment

        Working...