Databases, arrays and woes

From: Date: Thu, 30 Aug 2001 13:17:51 +0000
Subject: Databases, arrays and woes
Groups: php.general 
Request: Send a blank email to php-general+get-65274@lists.php.net to get a copy of this message
I have a MySQL table which stores information like this: | Type | Place Name | Place Abbrv | and lets say I have data in the table like: Example #1: | Office | Bill's Office | bo | | Store | Millcreek Supply | mcs | | Office | Harry's Office | ho | | Store | Sam's Discount Taxidermy | sdt | | Shipping | East Coast Distribution Facility | ecdf | What I'd like to do is be able to have PHP grab the information out of the database and sort like this on a webpage: Type Name #1: - Place Name (with hyperlink using the abbrv) - Place Name (with hyperlink using the abbrv) Type Name #2: - Place Name (with hyperlink using the abbrv) - Place Name (with hyperlink using the abbrv) For a better illustration, using the information from Example #1: Example #2: Office - Bill's Office (link using bo) - Harry's Office (link using ho) Store - Millcreek Supply (link using mcs) - Sam's Discount Taxidermy (link using sdt) Shipping - East Coast Distribution Facility (link using ecdf) So basically it has to group the common "Type" fields together and list them together and make a hyperlink. What is the best way to do this? I've tried arrays, different MySQL calls, voodoo, ouija boards and drinking, but nothing has gotten me what I need. btw, the information in "Type" is not a set number. There could be 2 or 200 different "Type". (Otherwise this would be much easier and I might not have a hangover from aforementioned drinking ;p ) - k

« previous php.general (#65274) next »