Re: RE: [PHP] Deleting multiple items from database using checkboxes

From: Date: Tue, 08 Oct 2002 15:44:17 +0000
Subject: Re: RE: [PHP] Deleting multiple items from database using checkboxes
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-16253@lists.php.net to get a copy of this message
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" <info@davyobdam.com> To: <holmes072000@charter.net>; "Php-Windows Mailing" <php-windows@lists.php.net> 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: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... > > >

« previous php.windows (#16253) next »