I\'m trying to get the Order Increment Id in Magento, on the success.phtml page so that I can use this for affiliate tracking.
I\'m using the following code, but it
$order in your code is the last order ID...as the function name implies. If this isn't the value you want, then use it to load an order, and then use the getter on that:
$order = Mage::getModel('sales/order');
$order->load(Mage::getSingleton('sales/order')->getLastOrderId());
$lastOrderId = $order->getIncrementId();