Posts by gkwelding

1 post
  • Has been part of the Envato Community for over 5 years
  • Has collected 1+ items on Envato Market
  • Located in United Kingdom
gkwelding says

easiest way to do this is have each delete checbox named like so

<input type="checkbox" name="delete[]" value={id of record} />

then in the php script do the following to escape the data:

foreach($_POST['delete'] as &$id) { $id = mysql_real_escape_string($id); } $values = array_values($_POST['delete']); $values = implode(',', $values); $sql = 'DELETE FROM {table} WHERE id IN ('.$values.')'; $query = mysql_query($sql);

this way the values are escape and you’re not creating a million database calls to do something that could be done with 1.

by
by
by
by
by
by