我需要如下所示的输出。我想为我的报告生成一个图表,所以我需要mysql_fetch_assoc的结果。 我是这个概念的新手。 基本上正在做mysql_fetch_array仅此而已,但现在我需要关联数组函数。
$date = array("date" => reading);
$data = array("28-Sep-2012" => .0032, "27-Sep-2012" => .0028, "29-Sep-2012" => .0021,
"24-Sep-2012" => .0033);
试试这样,
$results = mysql_query("SELECT vaccum_value,date FROM vaccum_details where serial_number='10P1005'");
$data=array();
while ($row = mysql_fetch_array($results))
{
$data[$row['date']]=$row['vaccum_value'];
}
print_r($data);