Skip to main content
Inspiring
May 8, 2007
Question

Deleting Problem

  • May 8, 2007
  • 1 reply
  • 263 views
Hi, I think the Deleteion problem is very Problammtic to me instead, I am Impleting the Comments section which is shown when the admin approves them. BVasic form where the user submit the comments and then the link is sent to the admin. then admin is clicked the link a new page is opened where the option of like this is shown:

<cfif StructKeyExists(URL,'ImageID')>
<cfquery datasource="#dsn#" name="showcomments">
Select Comments, postedby from IComm
where 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 this the page where the admin has to choose the checkboxes and then delete them.

the deletion page is not working properly as i am implementing like this:

<cfif form.axtion IS "Delete">
<cfset minusvalue = Replace(form.MyComm,",","-","")>
<cfquery datasource="#dsn#">
Update IGall SET
comments = comments - #minusvalue#
where ID = #form.SID#
</cfquery>
<cfquery datasource="#request.datasource#">
Delete From IComm
WHERE ImageID = <cfqueryparam cfsqltype="cf_sql_integer" value="#form.SID#">
</cfquery>
</cfif>

thus when i delete the selected the checkbox value, it deletes the all values in the IComm table, while the other tables values comes to correct value.

i experimented in a lot way but in vain, if anyone had have hands in this plz help me
    This topic has been closed for replies.

    1 reply

    Inspiring
    May 8, 2007
    You have two submit buttons. If you click the delete one, the update one won't get passed to the action page. Use radio buttons or a select instead.
    gavy81Author
    Inspiring
    May 8, 2007
    What i am doing here is if i call the dlete button, the one query which is of update is updateing the IGALL table's comment column to the value for how many checkboxes i have selected..

    let see it like this, i have 4 comments, i want to delete the 3 comments, in the IGALL table, the comments have counted to 4 as whne i select the 3 checkboxes, the value is passed to the next page as:

    4-1-1-1 = 1

    update works as i need, but problem is coming in delete mode where i want to delete only the checked one with same IDS

    say four comments are in ICOMM table and all carry ImageID as 10

    wanna delete the 3 records and i like the fourth one, but not wanna it, so how that change can take place in the deletion query as if i check onw, or 2 or 3 records, the code of delete deletes the all records of the ICOMM whose ID's is 10.