Reply
catagorize results from a database
Old 08-29-2008, 04:55 PM catagorize results from a database
Super Talker

Posts: 120
Trades: 0
i have pictures stored in a database(with fields such as the url, the title)
on the page, it displays a certain bunch of the pictures.

im gonna add another field that would have a string, and then when it read the database it'd sort by the string.

right now it just displays the pictures.

i want it to take all of the ones that having matching of the new field, then display them as a group.
and write
Groupname:
pic pic pic
Groupname2:
pic pic pic

did that make any sence?
I can rephraze it if it didnt. or even just link my site n stuff
Skeddles is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 08-29-2008, 06:05 PM Re: catagorize results from a database
chrishirst's Avatar
Super Moderator

Posts: 22,237
Location: Blackpool. UK
Trades: 0
Normalising the tables and using a JOIN that linked images to categories would make more sense from a data storage point of view.

But anyhoo
use a RS with a "ORDER BY category" clause

loop around the recordset as normal
keep a flag with the current category, when it changes write out the category name then go on with the loop.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-29-2008, 09:19 PM Re: catagorize results from a database
Super Talker

Posts: 120
Trades: 0
is there a way to use order by twice? becuase I already have them sorted into other groups that are ordered. I kinda want them sorted into these new groups, then within those ordered by the first one. possible?
Skeddles is offline
Reply With Quote
View Public Profile
 
Old 08-29-2008, 09:37 PM Re: catagorize results from a database
chrishirst's Avatar
Super Moderator

Posts: 22,237
Location: Blackpool. UK
Trades: 0
ORDER BY column1, column2, columnN
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-30-2008, 05:59 PM Re: catagorize results from a database
Super Talker

Posts: 120
Trades: 0
Thank you so much, that was very helpful. Here's where I used it.

Last edited by Skeddles; 08-31-2008 at 12:12 AM..
Skeddles is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to catagorize results from a database
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11956 seconds with 13 queries