Results 1 to 4 of 4

Thread: How to add autoincrement field

  1. #1
    Proware's Avatar
    Proware is offline A Prolific Poster
    Join Date
    Mar 2006
    Location
    Sydney Australia
    Posts
    310

    Default How to add autoincrement field

    I want to add an autoincrement field to the Contacts table. This will be used as a unique reference to assign users for them to register on a landing page I am developing.

    The ID field is already a Primary key and so MYSQL will not allow me to create a new Autoincrement field.

    How can I implement such a field?
    Cheers

    David Younger
    TSM - The Service Manager
    http://www.theservicemanager.com


    Operating system type and version: Windows 2003 Server
    » Sugar Suite version 4.5.1e Professional
    » Webserver type and version Microsoft-IIS/6.0
    » PHP version 5.2.6
    » MySQL server version 5.0.51a

  2. #2
    ruchida's Avatar
    ruchida is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Feb 2005
    Location
    Japan
    Posts
    1,375

    Default Re: How to add autoincrement field

    How about creating a custom field of int type, and then change it to an unique key?
    Ryuhei Uchida
    Help Forum Moderator
    Calendar 2.0
    http://blogs.itmedia.co.jp/ruchida/

  3. #3
    Proware's Avatar
    Proware is offline A Prolific Poster
    Join Date
    Mar 2006
    Location
    Sydney Australia
    Posts
    310

    Default Re: How to add autoincrement field

    Wont this then clash with id_c in contacts_ctsm which is the primary key?
    Cheers

    David Younger
    TSM - The Service Manager
    http://www.theservicemanager.com


    Operating system type and version: Windows 2003 Server
    » Sugar Suite version 4.5.1e Professional
    » Webserver type and version Microsoft-IIS/6.0
    » PHP version 5.2.6
    » MySQL server version 5.0.51a

  4. #4
    ruchida's Avatar
    ruchida is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Feb 2005
    Location
    Japan
    Posts
    1,375

    Default Re: How to add autoincrement field

    You don't need to set the custom field a primary key, but you can only set it an unique key.
    Ryuhei Uchida
    Help Forum Moderator
    Calendar 2.0
    http://blogs.itmedia.co.jp/ruchida/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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
  •