Hi I have the following mysql query which breaks when I try to add the WHERE clause using an array. I think its in the right order but not sure if I'm wrong with the notation or something here. I am able to verify that $company_type does have data and is an array, but the SQL statement returns no results when I can verify that there are.
Thanks
"SELECT *,
( 6371 * acos(
cos(radians($lat)) * cos(radians(l.location_latitude)) *
cos(radians(l.location_longitude) - radians($lng)) +
sin(radians($lat)) * sin(radians(l.location_latitude))
) ) AS distance
FROM
company c
INNER JOIN
bcompanytocompany bc
ON c.company_id=bc.company_id
INNER JOIN
lcompany_types ct
ON bc.company_type_id=ct.company_type_id
INNER JOIN
bcompanytolocations bcl
ON c.company_id = bcl.company_id
INNER JOIN
address a
ON bcl.address_id = a.address_id
INNER JOIN
location l
ON a.address_location_id = l.location_id
INNER JOIN
postal_codes po
ON a.address_postal_id = po.postal_id
INNER JOIN
cities ci
ON po.city_id = ci.city_id
INNER JOIN
lprovinces pr
ON ci.province_id = pr.province_id
WHERE company_type_name
IN (".implode(',',$company_type).")
HAVING distance < $setdistance
ORDER BY distance
LIMIT 30"
$company_type? Strings? Integers?