PDA

View Full Version : Removing threads with no posts


krohnathlonman
06-30-2005, 05:23 PM
Ok, I've written something that removes alot of posts and threads but there's still for some reason alot of threads that don't have posts....


$sql = "DELETE FROM thread WHERE attach = '0'";
$result = mysql_query($sql) or die(mysql_error());
printf("<br>Crappy Threads Removed: %d\n", mysql_affected_rows());


$sql = "DELETE FROM post WHERE attach = '0'";
$result = mysql_query($sql) or die(mysql_error());
printf("<br>Crappy Posts Removed: %d\n", mysql_affected_rows());


How would I go about removing threads where the firstpostid no longer exists?

Marco van Herwaarden
06-30-2005, 08:19 PM
You can try fixing this with a 'Remove Orphan Threads' from the Update Counters screen in ACP. I suggest you also rebuild the Forum & Thread Information.

Also you could have removed those threads with the Prune function, no need to do this manual.