cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting MySQL Table results in a PHP Page

N/A

Sorting MySQL Table results in a PHP Page

I have just created a table in my F9 CGI Database for a football league table. I am trying to find out if there is a way I can sort the output by a few fields.

If anyone can help, would appreciate it.

Thanks
Steve

http://www.wobblersworld.co.uk

Problem page is http://cgi.wobbler.force9.co.uk/trial.php

Sad
3 REPLIES
N/A

Sorting MySQL Table results in a PHP Page

In your PHP script, you must be using an SQL "select" statement to extract the data you want from your table(s). If you look up the syntax of the select statement, you'll see there's an optional "order by" clause that allows you to determine how you want your result set to be ordered. So, if you simply add an appropriate clause to the SQL statement, you should get exactly what you want without having to do any sorting yourself in PHP -- in effect the database will have done it for you.

A couple of simple examples may be seen at JuicyStudio(!) and DevGuru.
N/A

Sorting MySQL Table results in a PHP Page

Thanks for that.

Linked pages have helped a lot.
N/A

Sorting MySQL Table results in a PHP Page

Elementary stuff on SQL is at http://www.w3schools.com. Links above are better, but that site produces all kinds of web related hand-holding guides.