'1' group by date_format(date, '%Y-%M') order by date_format(date, '%Y%m') desc"; } else { $month= "select date_format(end_date, '%Y-%m') as code,date_format(end_date, '%b-%Y') as name from appstore_data WHERE provider = '$ID' group by date_format(end_date, '%Y-%M') order by date_format(end_date, '%Y%m') desc"; } echo $month; echo ""; $result = mysql_query($month,$dbc) or die("ERROR device".mysql_error()); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { //echo ""; echo ""; } echo ''; ?>