thincom2000 |
03-23-2007 03:31 AM |
Well if you don't know which tables have `userid` in them, you'll be running a lot of queries depending on your forum, but you can do this (I recommend testing on a backup database first):
PHP Code:
$db->hide_errors(); $all_tables = $db->query_read("SHOW TABLES");
$getall = $db->fetch_array($all_tables); $db->free_result($all_tables);
foreach ($getall AS $get_all) { $create_query = "DELETE FROM $get_all WHERE `userid` = " . $vbulletin->GPC['userid']; $getro = $db->query_write($create_query); echo "Deleted User #" . $getro['userid'] . " from $get_all.<br />"; $db->free_result($getro); } unset($get_all, $getall, $create_query);
$db->show_errors();
That should delete every database entry associated with a particular userid. (You will end up with orphaned posts if they started any threads).
You could technically do it in ONE query, but I think the whole query might fail and stop if the `userid` field doesn't exist in one of the tables.
|