Hello, I have some issues selecting multiple rows, and yes I'm new to both MySQL and PHP. The query is as following:
SELECT *, CONCAT(locations.zip_code, ' ', locations.city) as location from locations, locations_associations where locations.zip_code = locations_associations.zip_code AND client_id = 1;
The query works just fine, but the thing is that I have multiple client_id's stored in a PHP array which I also need to know the location of. My logic tells me that the easiest way to insert multiple client_id's into the query, would be to implode the array and then insert each client_id into the query including a seperator of some sort. The alternative would be to create an loop that inserted a client_id one at a time, which seems like a long way around contra imploding. Anyway, is it possible in this case to put in multiple client_id's in the query, and how should they be seperated, I've tried with a comma like this:
SELECT *, CONCAT(locations.zip_code, ' ', locations.city) as location from locations, locations_associations where locations.zip_code = locations_associations.zip_code AND client_id = 1, 2, 3, 4;
Which gives me an error.
Thanks in advance.
Btw, I'm running MySQL 5.5.8 on my local machine.