Store db as comma separated string and i want to retrieve data from a string separated by commas.
https://code.sololearn.com/wKW8F3caReUY/?ref=app
is this code work properly or not bcz it is not showing me the required results
//$userData['city'] = 27 //cities in db are saved as 12,33,9,2,1,27,31
//$userData['hobbies'] = 3,24
//hobbies in db have values as 3,24,17,31
// how to i match these records/arrays by my sql db records
$SQL = "SELECT * FROM users_stats WHERE
type = '1'
AND
(
".in_array( $userData['city'] , explode(",", "'cities'") )."
OR
cities IN('all','pak')
)
AND
(
time = ".$currentTime." OR time = 'all'
)
AND
(
".((array_intersect( explode(",",$userData['hobbies']) , explode(",", "'hobbies'")) != null)?1:0)."
)
";