We gota go one step at a time here. You need to fix the spaceing on the php tag, what you have is just wrong, thats why it displays in the footer instead of actualy running. Once you put it that way on the site, we can look at what else the code is doing to try to find and fix the error.