PDA

View Full Version : Fix DB error when deleting attachment via CP



Mike Sullivan
Mon 16th Jun '03, 4:15am
This prevents a DB error when you try to delete an attachment for a post that hasn't actually been posted yet (still being written/previewed).

admincp/attachment.php. Change: (~line 634)


$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET attach = attach - 1 WHERE threadid = $post[threadid]");

to:


if ($post['threadid'])
{
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET attach = attach - 1 WHERE threadid = $post[threadid]");
}