2010-11-17 121 views
-2
$query="SELECT file_date,application,language,loc FROM table1 WHERE language!='total' AND module_id=306 ORDER by file_date"; 
    return(get_data($locdb_handler,$query)); 
} 

function get_data($handler,$qry){ 
    $result=mysql_query($qry,$handler); 
    while($row = mysql_fetch_array($result)){ 
    $data['data'][$row[0]]['data']['status'][$row[1]]+=$row[3]; 
    $data['total'][$row[0]]+=$row[3]; 
    } 

$ data ['data'] [$ row [0]] ['data'] ['status'] [$ row [1]] + = $ row [3] ; -----> 上面这行代表的是什么。 有一个简单的查询....我想knw我们如何映射这...请帮助关联数组逻辑--php

+2

那么问题是什么? – AndreKR 2010-11-17 13:04:06

回答

0

是的。在这个例子中,他们使用了关联数组。

希望有所帮助。


你可能想,如果你想有一个真正的答案,以一个实际的问题添加到你的问题;)

0
$data['data'][$row[0]]['data']['status'][$row[1]]+=$row[3]; 
$data['total'][$row[0]]+=$row[3]; 

相同

$data['data'][$row['file_date']]['data']['status'][$row['appliction']]+=$row['loc']; 
$data['total'][$row['file_date']]+=$row['loc']; 

但它不是一个关联数组,这意味着它使用字符串作为数组键而不是数字。所以$ row [0]是查询返回的第一列,$ row [1]是第二列,等等。