PDO connection if you prefer not to use a prerender service

@Hyperbytes AKA Mr MySQL, could I have made this into a single database connection using SQL replace on the 2 fields that needed it? Then only had a single statement to worry about and no php if statements to contend with.