\t\t\t\t\tFROM (
\t\t\t\t\t\tSELECT m.id, count(*) as cnt
\t\t\t\t\t\tFROM medlemmer as m, fremmoede as f 
\t\t\t\t\t\tWHERE m.id = f.mid AND dag >= '{$start_date}' AND dag < '{$end_date}'
\t\t\t\t\t\tGROUP BY m.id
\t\t\t\t\t\t) as t1
\t\t\t\t\tGROUP BY cnt
\t\t\t\t\tORDER BY cnt
ASDF;
$query = query($sql);
//default data
$data = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);
//actual data
$cnt = 0;
while ($row = $query->tryGet()) {
    $cnt++;
    while ($row[0] !== "{$cnt}") {
        $data[$cnt] = 0;
        $cnt++;
    }
    $data[$cnt] = $row[1];
}
//graph
$graph = new PHPGraphLib(400, 350);
$graph->addData($data);
$graph->setTitle($caption);
$graph->setGradient('red', 'maroon');
$graph->setYValues(false);
$graph->setXValuesHorizontal(true);
$graph->setDataValues(true);
$graph->createGraph();