Code for multiple posts delete.

  • bestempire
  • Newbie
  • Newbie
  • bestempire
  • Posts: 7

Post 3+ Months Ago

I am looking for some coding which can help me to delete multiple posts by ticking/choosing boxes. All I would like to do is to choose the posts first (by ticking) then choose Delete chosen Posts after wards. I need to implement this one my classified ads website which has many spam posts and need to be deleted

Currently I have to delete one by one which is very time consuming

Thanks for any idea or sample code.

  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Code: [ Select ]
DELETE FROM tablename WHERE id IN ('1','2','3',...N)

Assign id's to checkboxes and pass them via form. The request var in your language of choice will only receive those which were checked. Loop thru and insert the id's into the query.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8485
  • Loc: USA

Post 3+ Months Ago

Make sure to escape the submitted data in the form unless you are the only one seeing and performing the task.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 31 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.