Code for multiple posts delete.

  • bestempire
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Sep 18, 2003
  • Posts: 7
  • Status: Offline

Post July 17th, 2009, 10:24 pm

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.

Bestempire
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 17th, 2009, 10:24 pm

  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Joined: Jul 25, 2005
  • Posts: 2735
  • Loc: Nashville, TN
  • Status: Offline

Post July 19th, 2009, 4:01 pm

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.
I'd love to change the world, but they won't give me the source code.
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post July 19th, 2009, 9:27 pm

Make sure to escape the submitted data in the form unless you are the only one seeing and performing the task.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 121 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.