i have been trying to solve this but i could not do it by myself
So i have this sql query:
SELECT * FROM stats WHERE date >= '2014-03-01' and date <= '2014-03-07'
+-----------------------------+
+ date | visits +
+-----------------------------+
+ 2014-03-02 | 832 +
+ 2014-03-03 | 746 +
+ 2014-03-06 | 49 +
+-----------------------------+
I want to combine it with a php array so i get this output:
$array = array(
"2014-03-01" => 0,
"2014-03-02" => 832,
"2014-03-03" => 746,
"2014-03-04" => 0,
"2014-03-05" => 0,
"2014-03-06" => 49,
"2014-03-07" => 0,
);
Does anyone know how to get this done? Thank you very much for helping
$arrayalready defined (with keys), or are you building it dynamically when you get your db values?