|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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:
|
|
#3
|
|||
|
|||
|
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.
|
|
#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.
|
|
#5
|
|||
|
|||
|
Quote:
Im sorry, but I do not understand your answer. Will you please explain it to me a little more detailed? |
|
#6
|
|||
|
|||
|
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) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Duplicated information |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|