Code running in one theme but not the other I am using the Mobile Theme module to switch between my themes, in my primary theme's page-front template I have some PHP code including a select statement, it queries tables created by a contributed module. The code works fine in my primary theme but in the mobile theme, the PHP returns nothing. What could cause this change from one Theme's page-front to another? None of this code relies on template.php, but I copied that over in case.
Themes are highly cached. That's a reason why you should avoid logic in them if only you can. And if you have to, put it in template.php, not .tpl files. Probable reason of query not executed is that template got cached and Drupal sees no reason to evaluate files again. You could force it to, probably, but it would be a huge performance killer.

Move your queries to contrib module, and query-based logic to template.php and you'll be good.