Ok so basically this is a query  you want to run ONE time to get the 
initial data set into the database? I'm assuming you'd be putting the 
page "content" and "title" in later?
I would do something as basic as...

Select the states
<cfquery name="getstates">
    select state, id from states
</cfquery>

Loop through the query...
<cfloop query="getstates">

If you have 10 pages i would insert each here w/ in the query statement, 
which then will loop through all 50 states and add 10 pages for each.  
I'm going to assume you would later go back and add the content, page 
title etc.

<cfquery name="insertpages">

    insert into pages
    (state,Pagename)
    values
    ('#state#','About')
   
    insert into pages
    (state,Pagename)
    values
    ('#state#','Page2')
   
    insert into pages
    (state,Pagename)
    values
    ('#state#','Page3')
   
    insert into pages
    (state,Pagename)
    values
    ('#state#','Page4')
   
    insert into pages
    (state,Pagename)
    values
    ('#state#','Page5')
  
</cfquery>
</cfloop>

Melissa Cope wrote:
> Thanks for the welcoming answers. :) I am relatively new to ColdFusion, but I 
> may have misstated my question; it's not the pulling information from the 
> database I'm not sure how to do, it's the setting the database up 
> (efficiently) in the first place.
>
> I figure each record will need five fields: the ubiquitous auto-incremented 
> ID, the page title, the page content, then the state and the page name (to 
> call in from the URL, like index.cfm?page=about&state=VA).
>
> Since all the states will have the same set of ten pages to start, it seems 
> that one should be able to use a cfloop of insert statements. Where I get 
> jammed up is figuring out how to tell it what state to insert in the state 
> field. Would it need to be a long cfswitch saying if i=1 the state is AL, if 
> i=2 the state is AK, etc.?
>
> Thanks again! 
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311193
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to