query
I have the queries that get values from other two tables and then insert those values into the final tables. My code below did not inserted the correct record.
Thanks
<!---list all purNo, padNo where purNo = 3215--->
<Cfquery name="getDetails" datasource="#dsn#">
select purNo, padNo
from tbl_details
where purNo = 3215
</Cfquery>
<!---list all cusNO where purNo = 3215--->
<Cfquery name="getCust" datasource="#dsn#">
select cusNO
from tbl_customer
where purNo = 3215
</Cfquery>
From the form, I have one text box for user to enter new date then hit submit. Once submit button is clicked, I would like to get the results from above two queries to insert into tblOrder.
<cfset note ="new date changed from" />
<cfloop query="getDetails">
<cfloop query="getCust">
<cfquery name="insert" datasource="#dsn#">
insert into tblOrder (purNo, padNo, cusNO, note)
values
(
<cfqueryparam value ="#getDetails.purNo#" />,
<cfqueryparam value ="#getDetails.padNo#" />,
<cfqueryparam value = "#getCust.cusNO#" />,
<cfqueryparam value="#note# #getDetails.old_ate# &'to' & #form.new_date#" />
)
</cfquery>
</cfloop>
</cfloop>
