Posts by gkwelding

1 post
  • Bought between 1 and 9 items
  • Has been a member for 5-6 years
  • 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