Re: I need info to delete duplicate products. after using the g

Posts: 5245
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

lol Hate to make ya lose much sleep on us... but then again, I do, too. Eye-wink

The quickest way to do this will be a script that queries the node table for any node ending in _0 and then deletes those nodes by nid:

<?php
  $result
= db_query("SELECT nid FROM {node} WHERE name LIKE '%_0'");
  while (
$data = db_fetch_array($result)) {
   
node_delete($data['nid']);
  }
?>

Backup your data before running that! You can try pasting that into a Drupal page w/ the PHP filter. Also, if you have phpMyAdmin, I'd recommend just running that query (remove the { }) in the SQL tab to see what nodes it pulls up. If those aren't the ones you want to delete, don't run this code. Eye-wink

I need info to delete duplicate products. after using the great csv import 0 1 alpha By: bowwowadmin (5 replies) Sat, 12/15/2007 - 07:15