Click here to get back home

Creating an unique record id ??

 HomeNewsGroups | Search | About
 mailing.database.mysql    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Creating an unique record id ?? Phil Latio 10-09-2005
Get Chitika Premium
Posted by Phil Latio on October 9, 2005, 1:15 pm
Please log in for more thread options
Have a database that records data taken in the field and was using an
"auto_incremented" integer. I now want to distribute the database to others
so they can record data then centralise all the data on one database so
people can share records.

However will an "auto_incremented" integer on it's own won't suffice? I
suppose it might if that field didn't have to be unique but is that best
practice? I was thinking along the lines of creating a unique field by
combining for 3-4 fields such as time, date, member and "auto_incremented"
integer.

What is this technique? I am sure there's a lot of stuff already on the 'net
explaining how to achieve this but I am a bit stuck as I don't know what
search terms to use.

Cheers

Phil




Posted by Aggro on October 9, 2005, 1:23 pm
Please log in for more thread options
Phil Latio wrote:
> Have a database that records data taken in the field and was using an
> "auto_incremented" integer. I now want to distribute the database to others
> so they can record data then centralise all the data on one database so
> people can share records.

There are few ways to do this:
- If you don't need to know what the id was on distributed computer,
just ignore it and assign a new id for it.
- Or add new id to identify source location. Then combine the remote id
with location id and you should have combination which would not only be
unique, but would also allow you to locate the source for given row
quite quiqly. ( It is recommended to add new table also, where are at
least two fields, id and name. ).

> However will an "auto_incremented" integer on it's own won't suffice? I
> suppose it might if that field didn't have to be unique but is that best
> practice? I was thinking along the lines of creating a unique field by
> combining for 3-4 fields such as time, date, member and "auto_incremented"
> integer.

While this would most likely never cause problem, there would still be
possibility that at some point two users would create exactly the same
row and it could cause problems. So I suggest you not to use this.


Posted by Phil Latio on October 10, 2005, 10:47 am
Please log in for more thread options
> While this would most likely never cause problem, there would still be
> possibility that at some point two users would create exactly the same
> row and it could cause problems. So I suggest you not to use this.

Thanks for your reply but the answer came to me.

I'll be using a PHP form to enter the data so each field value is a seperate
variable. I could simply create a new variable based on values of the
others.

Not it tried yet but sure it will work as I did something very similar when
learning the basics of Java.

Cheers

Phil




Posted by Aggro on October 10, 2005, 3:23 pm
Please log in for more thread options
Phil Latio wrote:

> I'll be using a PHP form to enter the data so each field value is a seperate
> variable. I could simply create a new variable based on values of the
> others.

Are you sure it is guaranteed to be unique? That there is no way in
world that someone could enter exactly same values and get the same id?


Posted by Phil Latio on October 10, 2005, 11:14 pm
Please log in for more thread options

> Phil Latio wrote:
>
> > I'll be using a PHP form to enter the data so each field value is a
seperate
> > variable. I could simply create a new variable based on values of the
> > others.
>
> Are you sure it is guaranteed to be unique? That there is no way in
> world that someone could enter exactly same values and get the same id?

I think so.

Cheers

Phil




Similar ThreadsPosted
Unique table version record July 26, 2006, 5:52 am
Unique version record in a MySQL database. July 26, 2006, 5:52 am
Creating a hyperlink to a specific record January 9, 2006, 2:05 pm
varchar and unique December 19, 2005, 8:13 am
getting unique records November 23, 2006, 9:58 am
inserting unique value June 21, 2007, 9:20 am
Returning unique records October 27, 2005, 12:35 pm
How to get the number of each unique items? October 28, 2005, 7:43 pm
Assigning unique ID to distinct values June 20, 2005, 12:44 pm
making a table with unique entries October 11, 2005, 11:44 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap