MySQL 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 'WHERE
`i`.`onoff` = 1
ASC
LIMIT 0, 1' at line 14
SELECT
`p`.`product_id`, `p`.`rewrite`
, `i`.`image_id`
FROM
`autoasia_catalog_images` `i`
INNER JOIN
`autoasia_catalog_products` `p`
ON
`i`.`product` = `p`.`product_id`
WHERE
`product` = '5025'
ORDER BY
`main` DESC
WHERE
`i`.`onoff` = 1
ASC
LIMIT 0, 1