ok, this should work now (multi-table deletion syntax changed between mysql 4.0 and mysql 4.1)

git-svn-id: file:///svn/phpbb/trunk@5728 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-03-26 11:36:54 +00:00
parent 8a32e0de74
commit 1e895071d4

View file

@ -1328,25 +1328,25 @@ class acp_forums
// Delete everything else and thank MySQL for offering multi-table deletion // Delete everything else and thank MySQL for offering multi-table deletion
$tables_ary = array( $tables_ary = array(
SEARCH_MATCH_TABLE => 'wm.post_id', SEARCH_MATCH_TABLE => 'post_id',
REPORTS_TABLE => 're.post_id', REPORTS_TABLE => 'post_id',
WARNINGS_TABLE => 'wt.post_id', WARNINGS_TABLE => 'post_id',
BOOKMARKS_TABLE => 'bm.topic_id', BOOKMARKS_TABLE => 'topic_id',
TOPICS_WATCH_TABLE => 'tw.topic_id', TOPICS_WATCH_TABLE => 'topic_id',
TOPICS_POSTED_TABLE => 'tp.topic_id', TOPICS_POSTED_TABLE => 'topic_id',
POLL_OPTIONS_TABLE => 'po.topic_id', POLL_OPTIONS_TABLE => 'topic_id',
POLL_VOTES_TABLE => 'pv.topic_id', POLL_VOTES_TABLE => 'topic_id',
); );
$sql = 'DELETE '; $sql = 'DELETE ' . POSTS_TABLE;
$sql_using = "\nFROM " . POSTS_TABLE . ' p'; $sql_using = "\nFROM " . POSTS_TABLE;
$sql_where = "\nWHERE p.forum_id = $forum_id\n"; $sql_where = "\nWHERE " . POSTS_TABLE . ".forum_id = $forum_id\n";
foreach ($tables_ary as $table => $field) foreach ($tables_ary as $table => $field)
{ {
// $sql .= ", $table " . strtok($field, '.'); $sql .= ", $table ";
$sql_using .= ", $table " . strtok($field, '.'); $sql_using .= ", $table ";
$sql_where .= "\nAND $field = p." . strtok(''); $sql_where .= "\nAND $table.$field = " . POSTS_TABLE . ".$field";
} }
$db->sql_query($sql . $sql_using . $sql_where); $db->sql_query($sql . $sql_using . $sql_where);