NogDog wrote:Assuming that the date column is a DATE, DATETIME, or TIMESTAMP type column in your database table:
. . . WHERE DATE_FORMAT(date, '%Y-%m') = '$month' . . .
$month = $year.'-'.$month;
echo $month;
$result = array();
$sql = mysql_query("SELECT * FROM resultat WHERE DATE_FORMAT(date, '%Y-%m') = '$month' AND user = $user AND kontroll = 'ok!'") or die(mysql_error("Det gick inte att nĂ¥ tabellen 'reslutat'"));
while($resultat = mysql_fetch_array($sql)){
$date = $resultat['date'];
echo $date; //echo nothing!?
$day = date('w', strtotime($date));
$week = date('W', strtotime($date));
$result[$week][$day]++;
}
print_r($result); //echos an empty array..?
It doesn't work. There are rows with dates that should have been selected from the sql. Does it matter that the date-column is of type date in the sql?
bradgrafelman> I don't know, all querys are behind a loggin, with a simple protection. It might even be mysql_real_escape_string(). ;-) Thanx for the tip.