Deleting Problem
hi, think deleteion problem problammtic me instead, impleting comments section shown when admin approves them. bvasic form user submit comments , link sent admin. admin clicked link new page opened option of shown:
<cfif structkeyexists(url,'imageid')>
<cfquery datasource="#dsn#" name="showcomments">
select comments, postedby icomm
imageid = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.imageid#">
</cfquery>
<cfform method="post" action="docomments.cfm">
<cfinput type="hidden" name="sid" value="#url.imageid#">
<table align="center" width="75%">
<cfoutput query="showcomments">
<tr>
<td width="20">
<input type="checkbox" name="mycomm" value="1"></td>
<td class="navlink_plain">
#trim(showcomments.comments)#
</td>
</tr>
<tr>
<td colspan="2">
posted by: #showcomments.postedby#
</td>
</tr>
</cfoutput>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="axtion" value="delete">
<input type="submit" name="axtion" value="update">
</div></td>
</tr>
</table>
</cfform>
<cfelse>
</cfif>
so page admin has choose checkboxes , delete them.
the deletion page not working implementing this:
<cfif form.axtion "delete">
<cfset minusvalue = replace(form.mycomm,",","-","")>
<cfquery datasource="#dsn#">
update igall set
comments = comments - #minusvalue#
id = #form.sid#
</cfquery>
<cfquery datasource="#request.datasource#">
delete icomm
imageid = <cfqueryparam cfsqltype="cf_sql_integer" value="#form.sid#">
</cfquery>
</cfif>
thus when delete selected checkbox value, deletes values in icomm table, while other tables values comes correct value.
i experimented in lot way in vain, if had have hands in plz me
<cfif structkeyexists(url,'imageid')>
<cfquery datasource="#dsn#" name="showcomments">
select comments, postedby icomm
imageid = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.imageid#">
</cfquery>
<cfform method="post" action="docomments.cfm">
<cfinput type="hidden" name="sid" value="#url.imageid#">
<table align="center" width="75%">
<cfoutput query="showcomments">
<tr>
<td width="20">
<input type="checkbox" name="mycomm" value="1"></td>
<td class="navlink_plain">
#trim(showcomments.comments)#
</td>
</tr>
<tr>
<td colspan="2">
posted by: #showcomments.postedby#
</td>
</tr>
</cfoutput>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="axtion" value="delete">
<input type="submit" name="axtion" value="update">
</div></td>
</tr>
</table>
</cfform>
<cfelse>
</cfif>
so page admin has choose checkboxes , delete them.
the deletion page not working implementing this:
<cfif form.axtion "delete">
<cfset minusvalue = replace(form.mycomm,",","-","")>
<cfquery datasource="#dsn#">
update igall set
comments = comments - #minusvalue#
id = #form.sid#
</cfquery>
<cfquery datasource="#request.datasource#">
delete icomm
imageid = <cfqueryparam cfsqltype="cf_sql_integer" value="#form.sid#">
</cfquery>
</cfif>
thus when delete selected checkbox value, deletes values in icomm table, while other tables values comes correct value.
i experimented in lot way in vain, if had have hands in plz me
you have 2 submit buttons. if click delete one, update 1 won't passed action page. use radio buttons or select instead.
More discussions in ColdFusion
adobe
Comments
Post a Comment