I need to create an array ($fruits) out of the unique values found in a MySQL table.
Example:
id|value
1|apple
2|pear
3|apple
4|apple
5|orange
I am leaning toward using...
$fruits=array_unique($fruits);
sort ($fruits);
But this requires pumping a bunch of fruits into an array. I am working with 50,000+ records and this seems to be inefficient. Is there a method in MySQL (or a better one in PHP) that will trim down my list of fruits to 'apple, pear, orange'?
- - picklefish - -
Example:
id|value
1|apple
2|pear
3|apple
4|apple
5|orange
I am leaning toward using...
$fruits=array_unique($fruits);
sort ($fruits);
But this requires pumping a bunch of fruits into an array. I am working with 50,000+ records and this seems to be inefficient. Is there a method in MySQL (or a better one in PHP) that will trim down my list of fruits to 'apple, pear, orange'?
- - picklefish - -