There is an error on the SQL command.

SQL:
select p.*, t.town, c.county from geo_towns t, geo_counties c, geo_regions r, pubs p where p.pub_town = t.id and t.county_id = c.id and c.region_id = r.id and pub_online = 1 and pub_active = 1 and pub_id =

Error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3