It's generally a bad idea to specify identity values into your code,
especially for ones that are auto-incrementing.  If you have to move your
code to another server or even re-create your data, the identity values
could change which would force you to edit your code.  You could just pass
the State ID in the URL string when a person wants to view that page.
Another method would be to have a another column in the table that holds the
state abbreviation, and use that in your where clause:
WHERE state_abbr = <cfqueryparam value="#url.state_abbr#"
cfsqltype="cf_sql_varchar">

Using the state abbreviation would only be when you're querying for
display.  I would manually create records for each state and only allow
editing in the administrative portion of your application.  For editing
purposes, your administration app could dynamically create a list of links
for each state record which would pass the State ID in the url.


On Mon, Aug 18, 2008 at 11:05 AM, Melissa Cope <[EMAIL PROTECTED]> 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:311190
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