1 Reply Latest reply on Nov 16, 2008 3:05 PM by Günter Schenk

    Prefixing and auto-increment field

      Hello

      I have a web application (php/mySQL) that has an auto-increment primary key field called job_id.

      Could anyone help me add a prefix to this?

      I want to add the year and month (YYMM/) in front of the field (e.g. 0811/1234 then 0811/1235 assuming current month and year is Nov 2008).

      Maybe Im wrong about adding the prefix to the primary key. Should I maybe add an additional field to maintain this?

      Any advice greatly appreciated...

      Regards

      Paul
        • 1. Re: Prefixing and auto-increment field
          Günter Schenk Level 4
          Hi Paul,

          MySQL table and column names may only consist of letters, underscores and numbers anyway, so the date format you´d like to use would lead to errors due to the forward slashes.

          ------
          Maybe Im wrong about adding the prefix to the primary key.
          ------

          I don´t know what you want to achieve with this approach, but I´d really leave the name of the Primary Key column "as is" and use a different column for storing data which contains such date values.

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver