RE: [PHP] indexing records

From: Date: Tue, 15 May 2001 13:37:58 +0000
Subject: RE: [PHP] indexing records
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52847@lists.php.net to get a copy of this message
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:midget@elaris.com] Sent: Wednesday, April 18, 2001 11:26 AM To: php-general@lists.php.net 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: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#52847) next »