A Database Error Occurred

Error Number: 1064

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 ') as distance, (RAND() * (weight + 1)) as rnd, ad_space.*, upload.id as upload_i' at line 1

SELECT getDistance(`venue`.`lat`, `venue`.`lng`, ) as distance, (RAND() * (weight + 1)) as rnd, ad_space.*, upload.id as upload_id, upload.source, `api_ex2`.`id` as net_exc_id FROM (`ad_space`) LEFT JOIN `venue` ON venue.id=ad_space.rel_id LEFT JOIN `upload` ON (upload.data_type="banner" AND upload.object_id=ad_space.id) LEFT JOIN `api_exclusion` api_ex2 ON api_ex2.data_type="ad_space" AND api_ex2.object_id=ad_space.id AND api_ex2.api_filter_id=1 WHERE `ad_space`.`data_type` = 'banner' AND `ad_space`.`data_sub_type` = 'map' AND (DATE(NOW()) BETWEEN DATE(ad_space.start_date) AND DATE(ad_space.end_date) AND ad_space.status="active") HAVING `distance` <= 60 AND `net_exc_id` IS NULL ORDER BY `rnd` DESC

Filename: models/ad_space.php

Line Number: 1208