XML Syntax within coldfusion
I am trying to write some xml within a coldfusion page, but unfortunately have no experience with XML.
In it's most basic format if i hard code the values the code below works fine;
getprice.cfm
<?xml version="1.0"?>
<PriceData Ver="2.0" Status="Complete" Design="ARGB1">
<Prices>
<Val Key="1">$ 47.50</Val>
<Val Key="6">$ 42.80</Val>
<Val Key="10">$ 38.50</Val>
<Val Key="21">$ 33.49</Val>
<Val Key="50">$ 30.15</Val>
</Prices>
</PriceData>
However I am trying to query a database to get these prices, something like below. I'm really unclear how this should be formatted but from searching google i believe something like this is possible? I cant get my page to work. Any help with syntax appreciated. Thanks...
getprice.cfm
<cfxml casesensitive="no" variable="PriceData">
<!--------------------Get prices from database---------------------------------->
<cfquery name="pricequery" datasource="#client.dsn#" username="#client.username#" password="#client.password#">
Select * from custom_signs
where material=<cfqueryparam value='#trim(url.material)#' cfsqltype="cf_sql_varchar" maxlength="20">
AND w2w_size=<cfqueryparam value='#trim(url.size)#' cfsqltype="cf_sql_varchar" maxlength="20"> and
type = <cfqueryparam value='#trim(url.Password)#' cfsqltype="cf_sql_varchar" maxlength="14"></cfquery>
<?xml version="1.0"?>
<PriceData Ver="2.0" Status="Complete" Design="ARGB1">
<Prices>
<cfoutput query="pricesquery">
<Val Key="#XMLFormat(pricesquery.LowQTY)#"><cfoutput>#XMLFormat(pricesquery.price)#</cfoutput></Val>
</cfoutput>
</Prices>
</PriceData>
</cfxml>
