The if staement:
if (!function_exists("GetSQLValueString")) {
<GetSQLValueString function code>
}
needs to be on both the template and the the details page, it should be on any page that uses that function. I added it to the template to correct the problem.