PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Because you are only checking the next one, what happens if the next one is different and the one after is the same. Whats going on with your IF statement it is empty and you are only using the ELSE?
Definitely do it in the sql. Even if you managed to improve your system it is a waste of resources, what is the point of bringing all the data out, then sorting it and only using part of it. SQL is designed to do all that for you, then you only ever bring out what is needed.
Because you are only checking the next one, what happens if the next one is different and the one after is the same. Whats going on with your IF statement it is empty and you are only using the ELSE?
Definitely do it in the sql. Even if you managed to improve your system it is a waste of resources, what is the point of bringing all the data out, then sorting it and only using part of it. SQL is designed to do all that for you, then you only ever bring out what is needed.
after more testing, i would like to thank you very much
as GROUP BY works great n is more reliable