View Single Post
  #5 (permalink)  
Old 18-03-05
DanielCoe's Avatar
DanielCoe DanielCoe is offline
Home is where I hang my @
 
Join Date: Sep 2003
Location: My Bedroom
Posts: 408
Thanks: 0
Thanked 0 Times in 0 Posts
DanielCoe is an unknown quantity at this point
Hi,

OLBG - that would be fine, but I want to display a date even if there is no data corresponidng to that date in the DB.

The way I have gone about it is to get the number of days in the month - in PHP this is:

date("t")

Then I have looped around every day in the month and within the loop fire a select to get the data (if any) from MySQL.

If no data is returned, make the data/figure a '0', then display the date and '0' data, otherwise display the data and the database value.

It works perfectly, and fast.

But, the only downside I see is firing off 28-30 selects (1 for each day of the month) .

I'd love to know if there is an easier way but with only using 1 SQL query.

Daniel
Reply With Quote