Re: Delete Multiple Records From Checkboxes

From: Date: Thu, 27 May 2004 02:01:58 +0000
Subject: Re: Delete Multiple Records From Checkboxes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-187028@lists.php.net to get a copy of this message
Albert Padley wrote:
I've checked the archives and several other sources, but still can't seem to make this work. I have a form with checkboxes to designate records to be deleted from the mysql database. The pertinent form code is: <input type=\"checkbox\" name=\"del[]\" value=\"" . $row['id'] . "\"> The processing code is: if (count($del) > 0){
    for ($i=0;$i<count($del);$i++){
            $query = "DELETE FROM ref_events_reg WHERE id = '$del[$i]'";
} } Echoing the query produces: DELETE FROM ref_events_reg WHERE id = A
Should be: $query = "DELETE FROM ref_events_reg WHERE id = '{$del[$i]}'"; or $query = "DELETE FROM ref_events_reg WHERE id = '".$del[$i]."'"; -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#187028) next »