Most developers want to keep their code seperate from their design / templates, using smarty php is the best way to do this. This way you can send your designer the template without having them mess with your code.
http://smarty.php.net for more information.
In regards to the php built-in database functions, they just don't seem to cut it.
So what i suggest is to use the ADODB library.
This will noticably increase the speed of your queries, outputs and to top it off will make things much more simpler while managing your database via php.
http://adodb.sourceforge.net/ for more information.