Advertisement

07.12.2008 at 10:15AM PDT, ID: 23559784
[x]
Attachment Details

Select data from a DATETIME column ordering by days

Asked by johanna_f in MySQL, Databases Miscellaneous, PHP and Databases

Tags: Sun, MySQL, 5, PHP-MySQL on 2003 IIS6

Hallo
I'm running a simple webradio with spacialaudio SAM. This program stores datetime and listeners number among other data into a mysql table. Radio is onair from 8am to 8pm.

here is partial hystorylist table
Column Name | Datatype
date_played   | DATETIME
listeners         | MEDIUMINT(9)

I would like to show on a web page some data so to have an idea of how the radio is going
1. Avarage listeners from radio startup
2. Max listeners ever

and some more other:
1. monthly avarege listeners divided by "zone hours" displayed by year
(ie. how many listeners during the morning [9/12am] or the noon [3-6pm]
<< year 2008 >>
month        | morning listeners  | noon listeners
Gen           | 25.2                      | 19.3
Feb            | 34.3                      | 21.5
Mar            | 18.1               etc...)

2.day avarege listeners divided by "zone hours" displayed by month
(ie. how many listeners during the morning [9/12am] or the noon [3-6pm]
<< Month June >>
day            | morning listeners  | noon listeners
Mon           | 25.2                      | 19.3
Tue            | 34.3                      | 21.5
Wen           | 18.1               etc...)

I started writing some code:
$hour=16;
$minute=15;
$month="June";

mysql_db($database_radio, $radio);
$query_Chart = "SELECT ID, DAYNAME(date_played) as day, DATE_FORMAT(date_played, '%e %M') as dateplayed, date_played, listeners FROM historylist WHERE DATE_FORMAT(date_played, '%M') = '$month' AND HOUR(date_played) = '$hour' AND MINUTE(date_played) = '$minute' AND listeners > 0 ORDER BY date_played ASC";

as a starting point but have no clue on how to go on... (listeners >0 is to avoid 0 listeners for a relay fault which may happen sometime)

thanks
Johanna
Start Free Trial
[+][-]07.12.2008 at 10:43AM PDT, ID: 21989850

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MySQL, Databases Miscellaneous, PHP and Databases
Tags: Sun, MySQL, 5, PHP-MySQL on 2003 IIS6
Sign Up Now!
Solution Provided By: cedlinx
Participating Experts: 1
Solution Grade: B
 
 
[+][-]07.12.2008 at 12:59PM PDT, ID: 21990213

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 03:38AM PDT, ID: 22014615

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 06:27AM PDT, ID: 22015656

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628