RE: [PHP-DB] record deletion using checkbox array values

From: Date: Wed, 08 Aug 2001 09:15:10 +0000
Subject: RE: [PHP-DB] record deletion using checkbox array values
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-11135@lists.php.net to get a copy of this message
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:mru@suchtreffer.de internet: http://www.suchtreffer.de _______________________________________________________________ > -----Original Message----- > From: Karl Phillipson [mailto:Karl@SaffronHill.com] > Sent: Wednesday, August 08, 2001 11:03 AM > To: php-db@lists.php.net > 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 > >

« previous php.db (#11135) next »