I posted this before, but maybe in a dead thread.
I have a MySQL database like this:
ID | Material | Packaging | Weight
01 | Plastic | Box | 10 kg
02 | Wood | Reel | 5 kg
03 | Plastic | Reel | 5 kg
04 | Metal | Box | 10 kg
05 | Metal | Reel | 5 kg
I can retrieve an array (e.g. Material) and loop through it using 'while' and 'echo', or 'printf' etc., and get a print out like this:
Plastic
Wood
Plastic
Metal
Metal
but is there a way to loop through the array and produce another array with these elements which can then be manipulated further, e.g. to remove the duplicates?
I have done a lot of searches but can only find ways of printing this to the browser, not producing and retrieving a result. I'm sure there's a simple answer.
sprintf seems to produce a string, but I can't find info on a way of using the returned result.