Php mysql select statment help


I am trying to select data from a mysql database.
I have an initial query which selects data from a products table, one of the fields in the table is a location_id field.
This field relates to the Locations table in the database.

The info within this location_id field can be something like this 123456, 1234789, 98765

These are location ids where the product can be purchased from.
I need to set up a select statment which will display all the different location info for each of the location id’s.

Can anyone tell me the best way of doing this please?
The location_id field can sometimes have only 1 value in it and other times can have several. Its this part of it thats confusing me just now.

Any help would be much appreciated.

Thanks in advance.

I can get the

of course, because your table design violates first normal form

is there any chance that you can redesign your table?

because your query isn’t going to work otherwise

Normalize your database. Multiple values in one column sooner or later will cause you problems.
In this case, create a new table, productlocations, with two columns: product_id and location_id, that will contain a row for each product-location pair. And get rid of the location_id column in the products table.

Thanks for the answers, I worked it out. Appreciate the help.