jerrykovach
asked on
Updating multiple values
I am trying to set all phone_display values to 1 where the #phoneid# has been passed in. Should I be using a <cfloop> tag? Also, I am not able to display the records from the DisplayPhoneNumbers query.
<!--- Begin Phone number Display Section --->
<cfif isDefined("form.phone")>
<CFQUERY NAME="UpdateContact_Phone1 " DATASOURCE="O2K_DEV">
UPDATE CFUSION.CONTACT_PHONE
SET PHONE_DISPLAY=0
WHERE (CONTACT_ID = 125)
</CFQUERY>
</cfif>
<cfif isDefined("form.phone")>
<CFLOOP INDEX="phoneid" LIST="#form.phone#">
<CFQUERY NAME="UpdateContact_Phone" DATASOURCE="O2K_DEV">
UPDATE CFUSION.CONTACT_PHONE
SET PHONE_DISPLAY=1
WHERE (PHONE_ID = #phoneid#)
</CFQUERY>
</CFLOOP>
</cfif>
<cfif isDefined("form.phone")>
<CFQUERY NAME="DisplayPhoneNumbers" DATASOURCE="O2K_DEV">
SELECT CONTACT_ID, PHONE_COMMENT, PHONE_NUMBER, PHONE_DISPLAY
FROM CFUSION.CONTACT_PHONE
WHERE (CONTACT_ID = 125) AND (PHONE_DISPLAY = 1)
</CFQUERY>
</cfif>
<table>
<cfif isDefined("form.phone")>
<cfoutput query="DisplayPhoneNumbers ">
<tr>
<td>#DisplayPhoneNumbers.P HONE_COMME NT#</td>
<td>#DisplayPhoneNumbers.P HONE_NUMBE R#</td>
</tr>
</cfoutput>
</cfif>
<!--- begin memo display --->
<!--- Begin Phone number Display Section --->
<cfif isDefined("form.phone")>
<CFQUERY NAME="UpdateContact_Phone1
UPDATE CFUSION.CONTACT_PHONE
SET PHONE_DISPLAY=0
WHERE (CONTACT_ID = 125)
</CFQUERY>
</cfif>
<cfif isDefined("form.phone")>
<CFLOOP INDEX="phoneid" LIST="#form.phone#">
<CFQUERY NAME="UpdateContact_Phone"
UPDATE CFUSION.CONTACT_PHONE
SET PHONE_DISPLAY=1
WHERE (PHONE_ID = #phoneid#)
</CFQUERY>
</CFLOOP>
</cfif>
<cfif isDefined("form.phone")>
<CFQUERY NAME="DisplayPhoneNumbers"
SELECT CONTACT_ID, PHONE_COMMENT, PHONE_NUMBER, PHONE_DISPLAY
FROM CFUSION.CONTACT_PHONE
WHERE (CONTACT_ID = 125) AND (PHONE_DISPLAY = 1)
</CFQUERY>
</cfif>
<table>
<cfif isDefined("form.phone")>
<cfoutput query="DisplayPhoneNumbers
<tr>
<td>#DisplayPhoneNumbers.P
<td>#DisplayPhoneNumbers.P
</tr>
</cfoutput>
</cfif>
<!--- begin memo display --->
ASKER
I agree, the specific question here is how do I loop through the update statement.
<cfif isDefined("form.phone")>
<CFLOOP INDEX="phoneid" LIST="#form.phone#">
<CFQUERY NAME="UpdateContact_Phone" DATASOURCE="O2K_DEV">
UPDATE CFUSION.CONTACT_PHONE
SET PHONE_DISPLAY=1
WHERE (PHONE_ID = #phoneid#)
</CFQUERY>
</CFLOOP>
</cfif>
I am passing in multipe values within the #form.phone# variable. How do I use that information to loop through the update statement?
<cfif isDefined("form.phone")>
<CFLOOP INDEX="phoneid" LIST="#form.phone#">
<CFQUERY NAME="UpdateContact_Phone"
UPDATE CFUSION.CONTACT_PHONE
SET PHONE_DISPLAY=1
WHERE (PHONE_ID = #phoneid#)
</CFQUERY>
</CFLOOP>
</cfif>
I am passing in multipe values within the #form.phone# variable. How do I use that information to loop through the update statement?
So is you LIST Form.Phone a Comma Delimited List?
questions is not clear. Please use an example string for what #form.phone# might have in the exact format. Do you want to make multiple updates within 1 update statement? is that the question?
Anusha
Anusha
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nathans,
I was able to figure this one out on my own. In the future, I will be much more specific on questons asked. I will give you full credit on this for responding in a very timely manner again.
Jerry
I was able to figure this one out on my own. In the future, I will be much more specific on questons asked. I will give you full credit on this for responding in a very timely manner again.
Jerry
DC