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!
Hello everyone and as usual thank-you in advance for any help and/or suggestions. I'm making a web page for my baseball league and again have come upon a little snag. I'm in the process of making the standings script. The values come from several joined MySQL tables resulting in a two dimensional array. My problem starts when I try to sort the array by the win% column only. I achieve my sort but since there are some NULL values my results are not great. Here is the sample of the code. How do I use the LIST() function with NULL values or is there an easier way. THANKS
Thanks for the response arborint. I like the simplified code. However, I'm still getting the same output, ie, it isn't displaying any of my NULL fields. Could my problem be in my sorting technique?
Yes, I thing usort() rebuilds the array with zero based indexes and may be removing your values. Try using your own sort algorithm that treats null the same as zero or ''. There is a sort function that takes a callback function for the comparison.