Or much easier

<cfset session[column_name] = project_Retrieval[column_name][currentRow]>


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

....-----Original Message-----
....From: Ben Mueller [mailto:[EMAIL PROTECTED]
....Sent: Friday, May 27, 2005 8:32 AM
....To: CF-Talk
....Subject: setting session vars to database field values
....
....I'm pretty sure that you don't need the evaluate in the first part of
....your <cfset statement.
....
....<cfset evaluate('session.#column_name#') =
....evaluate('project_retrieval.#column_name#')>
....
....The evaluate statement is going to try to return a value, but you don't
....have a value for session.#column_name# yet.
....
....Try this instead:
....
....<cfset "session.#column_name#" =
....evaluate("project_retrieval.#column_name#")>
....
....There may be other issues with your code, but that's the one that stood
....out to me.
....
....
....
....>I have a database with an unknown field set.  I want to take whatever
....>is in the DB and make a session variable for it.
....>
....><cfif structKeyExists(form,'project_category')>
....>         <cfset project_id = evaluate('form.#form.project_category#')>
....>         <CFQUERY name="table_dsc" datasource="dpch">
....>                 select column_name
....>                 from user_tab_columns
....>                 where upper(table_name) = upper('empower_project_data')
....>                 ORDER BY column_name
....>         </CFQUERY>
....>
....>         <CFQUERY NAME="project_retrieval" DATASOURCE="dpch">
....>                SELECT *
....>                FROM empower_project_data
....>                WHERE project_id = #project_id#
....>          </CFQUERY>
....>
....>
....>
....>   </cfif>
....>
....>                           <cfoutput query="table_dsc">
....>          #column_name#<br>
....>
....>          <!--- this part doesn't work --->
....>          <cfset evaluate('session.#column_name#') =
....>evaluate('project_retrieval.#column_name#')>
....>
....></cfoutput>
....>
....>This gives an error that you can't set a value to a function, which I
....>understand.  I'm not sure how to set a session var where I want it to
....>be the same name as the column in the database, without knowing that
....>column name ahead of time.
....>
....>--
....>Daniel Kessler
....>
....>Department of Public and Community Health
....>University of Maryland
....>Suite 2387 Valley Drive
....>College Park, MD  20742-2611
....>301-405-2545 Phone
....>www.phi.umd.edu
....
....

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207867
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to