Create another table in your database called "category" with columns, "id"
and "title", each record in category table should be something like:

1       Iran
2       Florida
3       Family
4       Friends

Then add a column to you picture table called "category_id", store the id of
each category in the new column category_id in the picture table.  Then when
you want to get picture out do this

SELECT picture.filename, picture.title, category.title FROM picture,
category WHERE picture.category_id = "1" ORDER BY picture.title

Where "1" is category_id of Iran or whatever.

Now if you want to associate pictures to multiple categories that is a
different story, but this should be enough to get you started.

Robert Zwink

-----Original Message-----
From: midget2000x [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 18, 2001 11:26 AM
To: [EMAIL PROTECTED]
Subject: [PHP] indexing records


What I want to do is figure out a way to index MySQL query results on my PHP
site that's not dependent on the id of each record.

I've got a MySQL photo database that runs my photo site.  Right now, the
'id'
field is a sequential, auto-incremented number, and I am using that id as an
index for the photos (because it was easy for me to grasp).

It works now because the groups are organized in order (for example all the
Iran pictures are sequential).  But

 -----------
providing the finest in midget technology

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to