<?php

function getEstateData($city='宁波',$fDate,$toDate){
    $mysqli = new mysqli('localhost','root','nancysimon','myquant');
    $sql=<<<EOF
    SELECT city, listdate,sum(nums) as num FROM `estate_listing` 
    where listdate>='$fDate' and listdate<='$toDate' and city='$city' group by listdate
EOF;
    $result = $mysqli->query($sql);
    $data=array();
    if($result && $result->num_rows>0) {
        while($row = $result->fetch_assoc()){
            array_push($data,array("value"=>array($row['listdate'],$row['num'])));
        }
    }

    return $data;
}
?>