Results 1 to 2 of 2

Thread: Auto increment or independant id? Mysql

  1. #1
    Join Date
    Jul 2009
    Posts
    71

    Auto increment or independant id? Mysql

    So here's what I'm trying to do. More or less I am building a map editor using php and mysql, now the table has the following columns: id, xAxis, yAxis, zAxis, type, contents. With those stated I was thinking and it would be much simpler to essentially have the cordinates create the unique id. So it would display like so: x:33;y21;z;-2;.

    Here's what I am wondering though how exactly would I break it appart to use each axis point for displaying the map? Or should I just simply remain using the individual points in their own column and use an auto increment for the id?

  2. #2
    Join Date
    Feb 2007
    Location
    Ireland
    Posts
    1,007
    A co-ordinate seems to be a unique identifier in your case. I assume you are looking for a primary key. You can create a multiple column primary key, so just use the three columns (xAxis, yAxis and zAxis) as your primary key.

    There's no need to extract the data from a single column as the co-ordinates are still in separate columns.
    “The best thing about a boolean is even if you are wrong, you are only off by a bit.”

Similar Threads

  1. auto increment in mysql
    By ketanco in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 03 Oct 2008, 08:37 PM
  2. New Free MySQL GUI
    By expert-database in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 21 Dec 2006, 05:45 PM

Posting Permissions

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