How to empty cart or clear session "externally"
This one should work as it removes all items from the current quote:
Mage::getSingleton('checkout/cart')->truncate();
But you need to save it afterwards:
Mage::getSingleton('checkout/cart')->save();
By the way, you can remove the following line:
$resource = Mage::getSingleton('core/resource');
since you don't use the variable and instantiating this singleton doesn't do anything in particular.