static id's dynamic price Workcube - Coldfusion
I want to set static id(product) and its dynamic price, if the id's price changes it will be displayed correspondingly, that's all I want, but I don't know the variable nor the structure of the queries and outputs, I don't know how to define the specific product's price in workcube using Coldfusion, this is as far as i've gone: And i know that the script below is wrong ^.^
<cfque开发者_StackOverflowry>
SELECT
PRICE_STANDART.PRICE PRICE
FROM
PRICE_STANDART
WHERE
PRICE_STANDART.PRODUCT_ID = #product_id#
</cfquery>
<cfset product_id = 612>
#TLFormat(price_standart)#
Think the following will work with your example:
<cfset product_id = 612>
<cfquery name="price_standart" datasource="#variableNameWithDatasourceName#">
SELECT
PRICE_STANDART.PRICE PRICE
FROM
PRICE_STANDART
WHERE
PRICE_STANDART.PRODUCT_ID =
<cfqueryparam value="#product_id#" cfsqltype="cf_sql_integer">
</cfquery>
<cfoutput>#LSCurrencyFormat(price_standart.price, "international")#</cfoutput>
cfqueryparam, while not necessary, prevents SQL injection attacks and serves as a bind variable with the JDBC driver.
LSCurrenyFormat will format a numeric value as currency. TLFormat()
is a not a built-in ColdFusion function.
精彩评论