Melissa,

I think I have a little better understanding of what you want now.  You are
talking about the initial 'records' in your database (before the user can
modify them) right?

So, what you could do is set up a few lines of code (maybe put in a
cfinclude even) that will query to see if that 'state' record exists and, if
not, then it will create the state record.  So something like this:

<cfquery> tag to get your state information for whatever url.state was
passed in
Now have the following:

<cfif NOT qQueryname.recordCount>
        .... in here, you put your <cfquery> to insert the state with your
'default information' (which you might also pull from the db with another
SELECT ...
        .... after you insert, before leaving this <cfif> do the same
<cfquery> you did initially to get the state information for url.state.  
</cfif>
....now your code to display continues.

This way, your state record gets created 'on demand' the first time someone
visits a page for that state, and it's built dynamically.

Is this closer to what you were looking for?

If you just want to set up all records initially, and you will only do it
once, you don't need a CF page for that.  Just write your SQL and run it in
the mySQL query browser or administrator to get all the records inserted
initially.  If it's a one time thing, I don't usually write a CF page for
that, especially since it is only 50 queries you're talking about.

Dave

-----Original Message-----
From: Melissa Cope [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 18, 2008 10:05 AM
To: CF-Talk
Subject: Re: Creating a database with repeated information

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:311194
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to