How do you delete a script?

Help with php delete script!!!!?

  • I am trying to delete multiple records on a forum with check boxes, but the code is not working. It is saying it has successfully been deleted but it doesn't delete the posts. Please help, 10 points for the best answer. $check="SELECT * FROM posts WHERE category_id='".$cid."' AND ID= '".$tid."'"; $result= mysql_query($check) or die(mysql_error()); $rows= mysql_fetch_assoc($result); $post_id=$rows['ID']; <input name='checkbox[]' type='checkbox' value='$post_id' /> if(isset($_POST['delete'])){ $checkbox=$_POST['checkbox']; $count_ids = count($_POST['checkbox']); //counting how many checkboxes have been selected. for($i=0;$i<$count_ids;$i++){ $del_id=$checkbox[$i]; $sqldelete = "DELETE from posts WHERE ID = $del_id"; $res4= mysql_query($sqldelete); echo"You have succsesfully deleted the selected post"; } ID is the ID of the post that someone has done.

  • Answer:

    I'm not sure if this is directly related to your problem or not but: <input name='checkbox[]' type='checkbox' value='$post_id' /> That value='$post_id' should be value='<? echo $post_id'; ?> if its not within the php code (which I assume its not because its html,

Dan at Yahoo! Answers Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.