--- Sue Robinson <[EMAIL PROTECTED]> wrote:

> I'll try to be clear !  Sorry!
>    
>   Anyone familiar with geocaching.com?  Geocaching is kind of like a treasure
> hunt, you use GPS to find hidden containers.  Some of these containers
> contain what are called "Travel Bugs" - usually an item of some sort, a toy
> or whatever that is attached to the official geocaching.com travel bug (they
> look like dog tags).  Each one of the travel bugs has a unique number which
> you can search for, and then see the history of where it's been on their web
> page.
>    
>   I would like to be able to do the same thing, only using my own unique
> numbers - I would place the item with the unique number in a cache and hope
> that whoever moved it would come to my web page and "log" it - obviously,
> they would have to be able to search for the number, log their new info on
> the web page,and see a new web page with the updated info.  
>    
>   Hopefully, that is more clear?  I'll try again if it's still confusing, or
> check out geocaching.com, go the "trackable items" and view the travel bug
> pages; I don't want or need anything that elaborate on my web site, just
> maybe a few fields that can be updated and the visitor can see the history of
> the travel bug.  Thanks again for the help,
>    
>   mp.

You may want multiple tables.  For example, one table would have the item
description, photos, details, etc. and use a unique key to identify it.  MySQL
does this well if the key is an integer.  You can have a key value to be
displayed in one column but an integer for the true primary key.  For a primary
key, only one row may exist for any particular value of the primary key.

The second table would be essentially a "log" with the primary key referring to
the other table (in database terminology a "foreign key") along with the data
you want to record about each event (date/time, location, who, etc.).

You will have to create queries which use both of these tables to look up the
data.

SELECT * FROM log l, items i WHERE l.id=i.id AND i.key='$key' ORDER BY dt DESC;

In this example I am assuming that the "items" table contains an integer
primary key ("id") and a human readable identifier ("key").  The "log" table
has a "dt" column with a datetime value (maybe even a timestamp value).

log
=====
lid  INT  PRIMARY KEY  AUTO_INCREMENT
id   INT
dt   DATETIME
lat  VARCHAR(32)
lon  VARCHAR(32)
who  VARCHAR(255)

items
=====
id   INT
name VARCHAR(255)
desc TEXT


James

Reply via email to