RE: [PHP-WIN] RE: [PHP] Deleting multiple items from database using checkboxes
| From: | Davy Obdam | Date: | Tue, 08 Oct 2002 15:07:45 +0000 |
| Subject: | RE: [PHP-WIN] RE: [PHP] Deleting multiple items from database using checkboxes | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16251@lists.php.net to get a copy of this message | ||
Hi John,
I have done this now but it gives an error message : Warning: Bad
arguments to implode() in C:\Program Files\Apache
Group\Apache2\htdocs\davy\guestbook2002\functions.php on line 318
It seems like the array $dele is empty to me, but i am not sure. This is
my code
//Make query
$ids = "'" . implode("','",$dele) . "'";
$sql_query ="DELETE FROM guestbook2002 WHERE entryID in ($ids)";
//Send query
$sql_id = mysql_query($sql_query, $link) or die("error in query");
And in my form i have this line:
<input type=\"checkbox\" name=\"dele[]\"
value=\"".$sql['entryID']."\">
Do u know why and do u know a solution?
Thanks already for your time.
Best regards,
Davy Obdam,
mailto:info@davyobdam.com
You wrote:
I think someone already mentioned this, but you can also do this:
if(isset($dele) && count($dele) > 0)
{
$ids = "'" . implode("','",$dele) . "'";
$sql = "delete from gastenboek where entryID IN ($ids)";
$result = mysql_query($sql);
}
might want to add in a is_array() somewhere in there...
---John Holmes...