Problem in cfoutput as CSS like

hi guys....hope u dont mind helping me again.

first table..css1.tbl

columns (4)
-----------------------------------------------------------------------
id(primary) | elements | opencurlybracket | closedcurlybracket
-----------------------------------------------------------------------
100 | a | { | }
101 | b | { | }
102 | td | { | }
103 | input | { | }
103 | .class | { | }

in my 2nd table..css2.tbl

columns()
id(foreign) | tag | colon | properties | semicolon
---------------------------------------------------------------
100 | color | : | blue | ;
100 | font-style | : | normal | ;
100 | font-size | : | 12px | ;
100 | font-family | arial | ;
101 | color | : | blue | ;
101 | font-style | : | normal | ;
101 | font-size | : | 12px | ;
101 | font-family | arial | ;
102 | color | : | blue | ;
102 | font-style | : | normal | ;
102 | font-size | : | 12px | ;
102 | font-family | arial | ;

of course 101 stands for a, 101 for b, 102 for td......and the rest

my query..

<cfquery name="table2">
select * from css2
</cfquery>

// i outputed table2 and at the same time i query table1

<cfoutput query="table2">
   <cfquery name="table1">
   select * from css1
  where id = '#table2.id#'
   </cfquery>

#table1.elements##table2.opencurlybracket# #table2.tag# #table2.colon# #table2.properties# #table2.semicolon##table2.closedcurlybracket#

</cfoutput>

it gives me this output

a {color:blue;}
a {font-style:normal; }
a {font-size:12px;}
a {font-family:arial;}
b {color:blue;}
b {font-style:normal; }
b {font-size:12px;}
b {font-family:arial;}
td {color:blue;}
td {font-style:normal; }
td {font-size:12px;}
td {font-family:arial;}

well how can i output something like this, CSS..

a {color:blue;
font-style:normal;
font-size:12px;
font-family:arial;}

b{color:blue;
font-style:normal;
font-size:12px;
font-family:arial;}

td {color:blue;
font-style:normal;
font-size:12px;
font-family:arial;}

if i got this output then i can save it as css file(sample.css)

i guess u can solve this pls......... i got no problem editing and inserting all properties in tables..only outputing.
fourth_noelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Renante EnteraSenior PHP DeveloperCommented:
Hello fourth_noel!

You can have your code like this :

<cfquery name="GetCSS1" datasource="#AppDataBase#">
SELECT * FROM css1
</cfquery>

<cfloop query="GetCSS1">
  <cfset css1ID = id>
  <cfquery name="GetCSS2" datasource="#AppDataBase#">
    SELECT * FROM css2
    WHERE id = #css1ID#
  </cfquery>
  <cfoutput>
    #elements##opencurlybracket#
    <cfloop query="GetCSS2">
      #tag##colon##properties##semicolon#
      <cfif currentrow neq recordcount>
        <br>
      </cfif>
    </cfloop>
    #closedcurlybracket#<br><br>
  </cfoutput>
</cfloop>

Hope this helps.  Just try it...


Goodluck!
eNTRANCE2002 :-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fourth_noelAuthor Commented:
wow...that was great.....hehe... it was working exactly as i wanted....thank u very much eNTRANCE2002......!!!

c u again............!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.