Jump to content

Need help about more than 1 deletion


PakiGangsta

Recommended Posts

Alright i have this as my code and it only deletes only one and that is it.
[code]
$box=$HTTP_POST_VARS['pm'];
$box_count=count($box);
foreach ($box as $dear) {
$del="DELETE FROM PM where ID='$dear'";
mysql_query($del) or die("Could not delete message");
echo "All selected private messages are deleted.";
include 'footer.php';
die();
}
[/code]
Please help me.
Link to comment
Share on other sites

1. This should be outside of the foreach loop.

[code]echo "All selected private messages are deleted.";
include 'footer.php';
die();[/code]

Meaning after 1 message is deleted, the script aborts. Remove it from the loop.

2. If it deletes 1 message, it should be OK as soon as the die() is removed from the loop; but if that still doesn't work, check if your checkbox have the correct name (like pm[]) and that it gives you correctly an array.

3. $HTTP_POST_VARS is deprecated. Use $_POST instead
Link to comment
Share on other sites

[!--quoteo(post=381231:date=Jun 7 2006, 08:01 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 7 2006, 08:01 PM) [snapback]381231[/snapback][/div][div class=\'quotemain\'][!--quotec--]
The query shouldn't be executed more than once; there is no need to abort the execution of the script. Remember that die() will abort the entire script's execution.
[/quote] fixed it and thanks for all the help i knewed it was the problem in die();
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.