Forum Moderators: coopster
I've got a MySQL database which stores monthly records from a weather station. I want to display info from this on a web page. Some data is already displayed as graphs but I want to add some trivia based on the current month.
The query to get the data is
SELECT Year, Rain FROM historical_data WHERE Month = '$current_month' ORDER By Rain DESC LIMIT 3
Fields in the DB are Year, Month, MaxTemp, MinTemp, Rain
Results of the query would be:
Year Rain
===========
year1 rain1
year2 rain2
year3 rain3
I want to show the top 3 records, laid out, eg:
"The wettest <current_month> was in <year1> when <Rain1>mm fell, followed by <year2> (<Rain2>mm) and <year3> (<rain3>mm)."
and not as a table, which would have been easier of course!
How do I put the data returned from the query into a PHP array so that I can display the data as desired?
I've experimented with while and for loops but without success.
Thanks.