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 'and active=1 ORDER BY ec.out_currency DESC,average' at line 1

select ec.*,exc.*,(select AVG(avg) from review where exchanger_id=exc.id and token='') as average,(select COUNT(id) from review where exchanger_id=exc.id and token='') as count from temp_currency ec left join exchanger exc on exc.id = ec.exchanger_id where ec.from_id = 155 and ec.to_id = and active=1 ORDER BY ec.out_currency DESC,average

Filename: /home/digitalmoneytalk/public_html/exchange/models/home_model.php

Line Number: 18