i tend to put my program full of code which takes into account the fact that maybe there is no data.
For instance a logo for a company. Instead of just putting out the logo, i first check if there is a logo.
If(logo==1) echo.........
Sometimes I just put the entire html in an variable and simply leave it empty when no data is present.
These are just two ways of dealing with this, but i suppose there have to be better approaches... Anyone?