First off, is this statement completely accurate:
vang wrote:sold date(yy-mm-dd)
? Are you sure it isn't YYYY-MM-DD, which is MySQL's format for storing data in a DATE column type... or is 'sold date' actually a VARCHAR column?
Also, what is it you're wanting to display exactly? Just the unit cost? How is that broken down into months... do you average all entries in the DB for a given month? Does the sold quantity come into play?
EDIT: Just to give you an idea of what I'm thinking thus far, I believe the key to the solution will be the use of "GROUP BY fruit, DATE_FORMAT(sold_date, '%b')" but there is some question as to what data you need for each month.
Once you figure out the data, you could loop through the DB results and build a multi-dimensional array, e.g.:
while($row = mysql_fetch_assoc($query))
$data[$row['fruit']][$row['sold_month']] = $row['data_collected'];