|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
Display unexpected results???
I have two tables:
Category (Programming Languages, Web Design, Database) Subcategory(PHP, Perl) PHP, Perl, C, ASP belong to category Programming Languages I wanna display category and subcategory by order from top to bottom. However I got unexpected results: - Programming Languages +--PHP - WebDesign +--Perl-Database I wanna show the result like this: - Programming Languages +--PHP +--Perl- WebDesign -Database My scripts: Quote:
Thank in advance, Tony Tran |
|
#2
|
||||
|
||||
|
before we address the sorting problem, is there any reason why you can't do a join?
it looks like you're doing a query inside a loop, which is quite inefficient |
|
#3
|
|||
|
|||
|
Hi r937,
Long time no see ya? How have you been? You are right, I am better to use the function JOIN. Let me try it first and report my results then. Merry Christmas and Happy New Year, Tony Tran |
|
#4
|
||||||
|
||||||
|
I am trying with JOIN function but I got an error even though the variable ID, name are in the table news_category.
Quote:
Here is my codes: Quote:
Note: If I change the code Quote:
to Quote:
then it works well. Thank you so much! |
|
#5
|
|||
|
|||
|
Once you get your query as a JOIN to retrieve the Categories and sub-categories, you can use the CFOUTPUT with the GROUP option to do what you need.
<cfoutput query="getCategories" group="Category"> Output the #Category# here <cfoutput> Output the #Subcategories# here </cfoutput> </cfoutput> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Display unexpected results??? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|