I hope this isn't a duplicate question, I have found many similar but none that match my requirements. I tried to get a solution with Splitting mysql value into unknown number of parts but I think maybe I asked the wrong question - I specified not wanting to use php with that question. It also is close to Can you split/explode a field in a MySQL query? but again, that doesn't quite define it. I installed common_schema which looks like it will be a powerful tool but I can't get it return the result I wish. I have tried foreach in conjunction with explode but I can't get all the data in the same array with it. Long preamble but here is the problem. I have a DB with the following table.
id
categories
100
|88|
102
|88|243|
442
|228|243|228|239|228|
I'm restructing this to put it into OpenCart.
So need it like this or in an array that I can use to create this
ID
category
100
88
102
88
102
243
442
228
442
243
442
228
etc
I don't have a problem getting it into and out of the database, just amending the data to tie up the ID to each category however many there may be in the field. I have spent about 2 days trying to find a solution and I'm sure it's very basic.
The closest I've got is with foreach
but ended up with an array
array ('ID' => 442,
'Category' => array (0 => 228, 1 => 243, 2 => 228 etc)