Welcome to Dream.In.Code
Become an Expert!

Join 136,939 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,853 people online right now. Registration is fast and FREE... Join Now!




how do i write a cfif tag to prevent multiple DB field display

 
Reply to this topicStart new topic

how do i write a cfif tag to prevent multiple DB field display

cumupkid
19 Mar, 2008 - 06:46 AM
Post #1

New D.I.C Head
*

Joined: 22 Jan, 2008
Posts: 21

Im trying to mak this list only show each type of database field once.

EX. database has feild of GALLERY and there can be several records with gallery 4, this list is to show gallery 4 but only once.

I think i need some kind of cfif tag but not sure how to write it.

Here is the code

<cfparam name="FORM.GALLERY" default="1">
<link href="../assets/styles.css" rel="stylesheet" type="text/css">
<cfquery name="qGallery" datasource="seanBerrodin">
SELECT GALLERY
FROM art
ORDER BY GALLERY ASC
</cfquery>

<cfoutput query="qGallery">

<table border="0" cellpadding="0" cellspacing="0" id="galleryNavbar">
<tr>
<td><a href="gallery.cfm?gallery=#qGallery.GALLERY#">#qGallery.GALLERY#</a></td>
</tr>
</table>
</cfoutput>
<p>&nbsp;</p>

User is offlineProfile CardPM
+Quote Post

sansclue
RE: How Do I Write A Cfif Tag To Prevent Multiple DB Field Display
19 Mar, 2008 - 07:41 AM
Post #2

D.I.C Head
**

Joined: 21 Nov, 2007
Posts: 113



Thanked: 7 times
My Contributions
Use SELECT DISTINCT in your query to eliminate the duplicates.


User is offlineProfile CardPM
+Quote Post

cumupkid
RE: How Do I Write A Cfif Tag To Prevent Multiple DB Field Display
19 Mar, 2008 - 11:03 AM
Post #3

New D.I.C Head
*

Joined: 22 Jan, 2008
Posts: 21

QUOTE(sansclue @ 19 Mar, 2008 - 08:41 AM) *

Use SELECT DISTINCT in your query to eliminate the duplicates.


Can you give me an example please?
User is offlineProfile CardPM
+Quote Post

cumupkid
RE: How Do I Write A Cfif Tag To Prevent Multiple DB Field Display
19 Mar, 2008 - 11:10 AM
Post #4

New D.I.C Head
*

Joined: 22 Jan, 2008
Posts: 21

QUOTE(cumupkid @ 19 Mar, 2008 - 12:03 PM) *

QUOTE(sansclue @ 19 Mar, 2008 - 08:41 AM) *

Use SELECT DISTINCT in your query to eliminate the duplicates.


Can you give me an example please?


never mind got it and thanks alot
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 10:51PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month