I’m having trouble ‘sorting’ my mysql results in php.
Here’s the database I have
id¦ value ¦ category --------------------------- 1 ¦ Value1 ¦ category1 2 ¦ Value2 ¦ category2 3 ¦ Value3 ¦ category2 4 ¦ Value4 ¦ category3 5 ¦ Value5 ¦ category1 6 ¦ Value6 ¦ category1
What I’m trying to do, is to get a result in php looking like this:
category1
- Value1
- Value5
- Value6
category2
- Value2
- Value3
category3
- Value4
Any help is useful. Thanks
thanks everyone for the help. I’m going to use a mix of AlienWebguy’s and jchavannes’s code which is working perfect, just what i was searching for.
the code looks like this:
SQL:
PHP: