EasyCFM.COM ColdFusion Forums / Coding Help! / Queries

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Queries

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

Mark
12-15-2004 @ 1:21 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 9
Joined: Sep 2004

I'm pretty used to Coldfusion, but there is one thing I have no idea to do so that is why I am asking for help.

Does anyone know if it is possible to take something out of a database (MySQL) and exectue. Like taking a '<cfif>" tag and still having it execute showing the result and not just <cfif> when viewing the webpage.

Thanks in advance.

Mark M.

GrowlyBear
12-15-2004 @ 1:58 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1314
Joined: May 2004

More details please, like why you would be storing cf code in a database.


~~~~~~~~~~~~~~~~~~~
There is no place like 127.0.0.1

falconseye
12-15-2004 @ 9:04 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 1033
Joined: Mar 2004

if i understand correctly, you may try something like

<cfquery name="myQ" datasource="myDB">
SELECT something
FROM somewhere
WHERE ClientName Like (%#FORM.ClientName#%)
<cfif IsDefined('FORM.date')>
AND date = '#FORM.date#'
</cfif>
.....


hope it helps

VelvettFogg
12-15-2004 @ 6:41 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 384
Joined: Dec 2004

Mark -- I think you can .. the key will be to use the Evaluate funtion ...

#Evaluate(myQuery.myFieldName)#

I *think* that if myQuery.myFieldName contains valid CF code that the Eval function will cause it to execute.

VelvettFogg
12-16-2004 @ 11:09 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 384
Joined: Dec 2004

After further consideration, I don't think this works.

The output of your query is parsed as a variable, and CF only makes one such parsing-pass.  

Only way I think it might work would be to insert the Evaluate function into the datatable, so that CF encounters in while is was evaluating the contents of that variable.

/shrug

In any event, if this is possible, it will require the use of the Evaluate function.



Sponsored By...
iOpenSoft, LLC is a Houston, Texas Advanced Technology Studio Specializing in Web Design, Web Development, iPhone App Development and Android App Development.