Hi Karl,

$delete = "'" . implode( "', '", $delete_list );
$delete = substr( $delete, 0, ( strlen( $delete ) - 3 ) );

then use: "DELETE FROM sent_items WHERE id IN ($delete)"

Not tested, but should work.

Greetinx,
  Mike

Michael Rudel
- Web-Development, Systemadministration -

Besuchen Sie uns am 20. und 21. August 2001 auf der
online-marketing-düsseldorf in Halle 1 Stand E 16
_______________________________________________________________

Suchtreffer AG
Bleicherstraße 20
D-78467 Konstanz
Germany
fon: +49-(0)7531-89207-17
fax: +49-(0)7531-89207-13
e-mail: mailto:[EMAIL PROTECTED]
internet: http://www.suchtreffer.de
_______________________________________________________________



> -----Original Message-----
> From: Karl Phillipson [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 08, 2001 11:03 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] record deletion using checkbox array values
>
>
> Morning people,
>
> I have a form with checkbox values, if checked  an array of
> id's are passed
> to a deletion script.
>
> I can get the array and implode to a string.
> Can anyone tell me how to delete all the messages in the DB
> that have the
> checked value.
>
> Presently the script is deleting only the last id value that has been
> checked.
>
> ---snip-----
>
> First the form:
>
>       <input type=\"checkbox\" name=\"delete_list[]\" value=\"$id\">
>
> submit etc....
>
> Then the deletion script:
>
>       <?php
>
>       $delete=implode(",", $delete_list);
>
>       if(!($result = mysql_db_query($DB, "DELETE FROM
> SENT_ITEMS WHERE ID
> = '$delete'")))
>               {
>               DisplayErrMsg(sprintf("internal error %d:%s\n",
>               mysql_errno(), mysql_error()));
>               mysql_close($link);
>               exit();
>               }
> ?>
>
>
> Been messing about with this one for a while now and I am
> getting a bit
> flustered!
>
> Thx in advance,
>
> Karl
>
>
> ==========================
> Karl Phillipson
> PHP SQL Programmer
>
> Saffron Hill Ventures
> 67 Clerkenwell Road
> London
> EC1R 5BL
>
> Saffron Hill: 0207 693 8300
> Direct Line: 0207 693 8318
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to