Re: Delete Multiple Records From Checkboxes
| From: | Albert Padley | Date: | Thu, 27 May 2004 04:37:54 +0000 |
| Subject: | Re: Delete Multiple Records From Checkboxes | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-187030@lists.php.net to get a copy of this message | ||
On May 26, 2004, at 8:01 PM, John W. Holmes wrote:
Albert Padley wrote:Sorry, same result. No records deleted. Echoing the query returns: DELETE FROM ref_events_reg WHERE id = 'A' However, the id should be an integer. A var_dump() returns: array(2) { ["del"]=> array(2) { [0]=> string(2) "15" [1]=> string(2) "16" } ["submit"]=> string(6) "Delete" } Further, when I echo $del[0], it returns -- 'A' while $del[1] returns 'r'. Just $del returns 'Array'. Still working on it. Albert PadleyI'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){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... John,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