ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 18th, 2005, 11:19 AM
Evilfish Evilfish is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Denmark, Copenhagen
Posts: 57 Evilfish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 7 m 8 sec
Reputation Power: 5
Duplicated information

Hi. This site im working on is http://market.evilfish.dk/browse.cfm

When you click the test1 or test2, 2 other values coms up. Those are dubplicated, which i cant understand, and i dont know how to fix. The code to the first row is:

Code:
<cfquery name="getgroups" datasource="Evilfis_db">
SELECT Name, Groupp
FROM Evilfis_mssqldb.market_Itemsgroup 
</cfquery>
<p> | <cfoutput query="getgroups"><a href="browse.cfm?group=#getgroups.groupp#">#getgroups.Name#</a> | </cfoutput> </p>

And the second row code is:
Code:
<p><cfif group NEQ 0>
<cfquery name="getsubgroups" datasource="Evilfis_db">
SELECT Name, Subgroup
FROM Evilfis_mssqldb.market_Itemssubgroup
WHERE (Groupp = <cfoutput>#group#</cfoutput>)
</cfquery>
| <cfoutput query="getgroups"><a href="browse.cfm?group=#group#&subgroup=#getsubgroups.Subgroup#">#getsubgroups.Name#</a> | </cfoutput>
</p></cfif>


The third row is similar to row 2

The 1 row works as it should, but why the dublicate on the second? As it is now, every group on the page has 2 subgroups. Different. So it finds 2 Records, but places first record twice.

Please help me with this.

Reply With Quote
  #2  
Old February 18th, 2005, 11:31 AM
VelvettFogg VelvettFogg is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 34 VelvettFogg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 13 m 46 sec
Reputation Power: 4
I'd go peek into your data table .. I wonder if the duplicates dont reside there.

Also .. this line...

WHERE (Groupp = <cfoutput>#group#</cfoutput>)

You dont need the <cfoutput> tags. Take them out.


Quote:
Originally Posted by Evilfish
Hi. This site im working on is http://market.evilfish.dk/browse.cfm

When you click the test1 or test2, 2 other values coms up. Those are dubplicated, which i cant understand, and i dont know how to fix. The code to the first row is:

Code:
<cfquery name="getgroups" datasource="Evilfis_db">
SELECT Name, Groupp
FROM Evilfis_mssqldb.market_Itemsgroup 
</cfquery>
<p> | <cfoutput query="getgroups"><a href="browse.cfm?group=#getgroups.groupp#">#getgroups.Name#</a> | </cfoutput> </p>

And the second row code is:
Code:
<p><cfif group NEQ 0>
<cfquery name="getsubgroups" datasource="Evilfis_db">
SELECT Name, Subgroup
FROM Evilfis_mssqldb.market_Itemssubgroup
WHERE (Groupp = <cfoutput>#group#</cfoutput>)
</cfquery>
| <cfoutput query="getgroups"><a href="browse.cfm?group=#group#&subgroup=#getsubgroups.Subgroup#">#getsubgroups.Name#</a> | </cfoutput>
</p></cfif>


The third row is similar to row 2

The 1 row works as it should, but why the dublicate on the second? As it is now, every group on the page has 2 subgroups. Different. So it finds 2 Records, but places first record twice.

Please help me with this.

Reply With Quote
  #3  
Old February 18th, 2005, 12:21 PM
Evilfish Evilfish is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Denmark, Copenhagen
Posts: 57 Evilfish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 7 m 8 sec
Reputation Power: 5
There is no dublicates in my database. That i have confirmed 1000 times before even posting here. I was sure that was my problem, but i guess not.

Reply With Quote
  #4  
Old February 18th, 2005, 12:34 PM
fortunato fortunato is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 33 fortunato User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 36 m 52 sec
Reputation Power: 4
When you output the subgroups, you should be outputting from the subgroup query, not the original group query, which had two rows. That is why your subgroup output always has the same number of rows as your first (group) output.

Reply With Quote
  #5  
Old February 18th, 2005, 02:24 PM
Evilfish Evilfish is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Denmark, Copenhagen
Posts: 57 Evilfish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 7 m 8 sec
Reputation Power: 5
Quote:
Originally Posted by fortunato
When you output the subgroups, you should be outputting from the subgroup query, not the original group query, which had two rows. That is why your subgroup output always has the same number of rows as your first (group) output.


Im sorry, but I do not understand your answer. Will you please explain it to me a little more detailed?

Reply With Quote
  #6  
Old February 18th, 2005, 04:16 PM
fortunato fortunato is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 33 fortunato User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 36 m 52 sec
Reputation Power: 4
Sure, in the second block of code from your post ...
I'd change it, so that the output query is over subgroups, not the groups query, something like below ...
Code:
<p><cfif url.group NEQ 0>
<cfquery name="getsubgroups" datasource="Evilfis_db">
SELECT Name, Subgroup
FROM Evilfis_mssqldb.market_Itemssubgroup
WHERE Groupp = #url.group#
</cfquery>
| <cfoutput query="getsubgroups"><a href="browse.cfm?group=#url.group#&subgroup=#subgroup#">#name#</a> | </cfoutput>
</p></cfif>


Something like that should help.
Also, if you scope your variables it makes things clearer for debugging. (I added the url scoped variables prefix in the code above)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Duplicated information


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway