hello,, i am a newbe in php can any one tell me how to delete multiple records in php , i am using dreamweaver as my front end tool and php triad for the back end .......


i want to learn how can i delete multiple records by passing the value of record id in my php query .... Plz help !:rolleyes:

hello,, i am a newbe in php can any one tell me how to delete multiple records in php , i am using dreamweaver as my front end tool and php triad for the back end .......


i want to learn how can i delete multiple records by passing the value of record id in my php query .... Plz help !:rolleyes:

What database are you using? And what you use to develop the program won't matter in the answer :)

Here's the basic idea:

.....
<input type="checkbox" name="id[]" value="1'/>
<input type="checkbox" name="id[]" value="2'/>
<input type="checkbox" name="id[]" value="3'/>
.....
$ids="";
foreach($_POST['id'] as $id) $ids.=((int)$id).",";
$ids=substr($ids,0,-1);

$query="DELETE FROM t1 WHERE id IN ($ids)";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.