The problem is in this code not the above code:
Code:
elseif (isset($_POST['deltab'])) {
$name = $_POST['name'];
$query = "SELECT * FROM ".constant("PREFIX")."tabs WHERE username='".$loggedinname."' AND name='".$name."'";
$stmt = $adopts->query($query);
$num = $stmt->fetch(PDO::FETCH_ASSOC);
if($num == 0){
$article_content='This cage does not exist.';
}else{
$adopts->update("owned_adoptables", array("tab" => ''), "owner='{$loggedinname}' and tab='{$name}'");
$adopts->delete("tabs", array(), "username='{$loggedinname}' and name='{$name}'");
$article_content='You successfully deleted the tab. Your hamster was automatically moved to your default cage at the <a href="myadopts.php">My Hamsters</a> page.';
}