multiple data in a single field is not a good idea.
You have the users table, that field which stores the comma delimitered list is locations_comma, and other fields.
You have another table, location, these table's primary IDs stored in the users table.
How should you build a better design ?
You should make a new table, called
connector_users_location
add two fields into this table (integer types):
users_id And location_id
Means users_id will be equal with users's user_id field, and location_id will be equal with the location table's loc_id
How to select from these 3 tables all connected fields?
SELECT users.user_id,location.loc_id,users.un,users.pass,users.details,location.city
FROM location INNER JOIN
(users INNER JOIN connector_users_location ON users.user_id = connector_users_location.users_id)
ON location.loc_id = connector_users_location.location_id
GROUP BY users.user_id , users.un,users.pass,users.details , location.loc_id , location.city;
Then you can create checkboxes with array variable name to manage user's locations.