I have table which one we have multiple category of each records with comma separated (event_type) we are passing comma multiple ids with comma separated. i found the query but its not giving result fine see below image of table structure. Mysql Structure enter code here
$query = "SELECT id,latitude, longitude, SQRT(POW(69.1 * (latitude - '".$lat."' ), 2) + POW(69.1 ('".$lon."' - longitude) COS(latitude / 57.3), 2)) AS distance FROM business_signup_details where event_type in (3,4) and business_details_approved = '1' HAVING distance < $distance ORDER BY distance";
As @Gordon told you have to change your database structure to store multiple value. Do normalization. Still if you want result you can use like
keyword:
$query = "SELECT id,latitude, longitude, SQRT(POW(69.1 * (latitude - '".$lat."' ), 2) + POW(69.1 ('".$lon."' - longitude) COS(latitude / 57.3), 2)) AS distance FROM business_signup_details where event_type like '%3,4%' and business_details_approved = '1' HAVING distance < $distance ORDER BY distance";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.