Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing dynamic info in Database

Status
Not open for further replies.

Bramvg

IS-IT--Management
Jan 16, 2001
135
BE
Hi,

I want to store text included with dynamisch variables e.g.
#session.userid# in a database.

This is of course no problem, but when I do an output
<cfoutput></cfoutput> I only get to see the code #session.userid# and NOT e.g. '13'

Do I have to add something when outputting or store extra information with a variable? Like: '\#session.userid\#' ?

So, what I want to do is to put my texts, including some dynamic parameters in a database field and when I do an output I want the result of the parameter, not the description of the parameter on my website.

Any suggestion more than welcome!

Regards
bram
 
Hey Bram,

You have it correct, the syntax for output a db query is just <cfoutput query=&quot;q1&quot;>#fieldname#</cfouptut>. You should never see the text &quot;#var#&quot; between <cfoutput> tags unless the variable &quot;var&quot; actually contains the text &quot;#var#&quot;. IOW, if it's behaving as you described, I think your database actually contains the text &quot;#session.userid#&quot; in the field. If this is the case, then I would look for a problem in your insert code.

If you'll post the code for your insert as well as the output including any code where you set session.userid, I or someone in the forums can show the problem.

Good luck,
GJ
 
Hi GunJack,


That is not realy my problem.
I will try to describe it better, sorry that it isn't clear.

What I do is retrieve all the texts which will be displayed on my site from the database. Because the text is personalized for each user (his/her name) I can't enter this in the same field. I give an example: Welcome Bram, how are you doing.

I would like to store this in the database as:
Welcome #session.Firstname#, how are you doing.

When I do this and run my cfquery and print this on my website with a cfoutput I get to see exactle what is in the database: &quot;Welcome #session.Firstname#, how are you doing.&quot;

Instead I want:
&quot;Welcome Bram, how are you doing.&quot;

So, the cfoutput prints exactly what is in the database, but I don't want that, I want to print the firstname of my user.

Hope you can help me out, I would be happy with a sollution! :)

With best regards
Bram - bram@vangrimbergen.com




 
you mean that what you store in/retrieve from the db is exactly your_field=&quot;welcome #session.name# etc&quot;, and when you want to display #your_field# the inside doesn't evaluate, right ?
you only need to EVALUATE #your_field#
i don't remeber the exact syntax but it should look like #evaluate(&quot;#your_field#&quot;)#
or maybe it should be better to re-think your app, and to store &quot;welcome easy_to_detect_chain etc&quot; and then replace &quot;easy_to_detect_chain&quot; with the VALUE of #session.name#
hope this helps !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top