Yeah, $dele is probably empty. That's why the original code had a
count($dele) in it to make sure there were elements there. You could use
is_array() in combination with that, too.

---John Holmes...

----- Original Message -----
From: "Davy Obdam" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Php-Windows Mailing"
<[EMAIL PROTECTED]>
Sent: Tuesday, October 08, 2002 11:07 AM
Subject: RE: [PHP-WIN] RE: [PHP] Deleting multiple items from database using
checkboxes


> 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:[EMAIL PROTECTED]
>
>
> 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...
>
>
>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to