Deleting multiple rows from mysql with checkbox?

Php // query to insert into database ... // ... etc... if(isset($_POST"formDeleteSelected")) { //query to delete the records $query = "DELETE FROM users WHERE id IN (" . Implode(", ",$_POST"rowid") .")"; $result = mysql_query($query); header("Location: mycode. Php"); // just so 'refresh' doesn't try to run delete again exit(); }?

> " method="post"> 0 ) { echo ""; while ($row = mysql_fetch_row($result)) { echo ""; echo ""; echo "" . $row0 . ""; echo "" .

$row1 .""; echo "" . $row2 . ""; echo ""; } echo ""; }?

This is probably a good time for another form: " method="post"> 0 ) { echo ""; while ($row = mysql_fetch_row($result)) { echo ""; echo ""; echo "" . $row0 . ""; echo "" .

$row1 . ""; echo "" . $row2 .""; echo ""; } echo ""; }?

> Or something like that (I haven't actually tried that code so there may be a typo). Also note that you should make sure to sanitize any form/get inputs for SQL Injection (plenty of information on that in other Stack Overflow questions).

Thank you for the valuable reply, will check out and reply back.. – Ibrahim Azhar Armar Aug 6 '10 at 8:51.

First of all you need a checkbox and the id you want to delete: Delete user You can then test if the checkbox has been set and then manually set the GET parameter to reuse your existing code: if(isset($_POST'delete')){ $_GET'id' = $_POST'user_id'; } That's not the most elegant solution but a really simple one that should work with your code.

Try an SQL query with a list of IDs ... WHERE id=$sentIds0 OR id=$sentIds1 OR ... or use a set operation ... WHERE id IN ($i1,$i2 ... ); You sure have to send ids in the form for this to work, but You know that ;).

Create table"test_mysql" in database "test". Create file delete_multiple.php.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions