从PHP中的select查询中删除标题

时间:2014-06-26 05:22:07

标签: php json sqlite select-query

有没有办法在SQLite中选择一个表而不打印列标题?

以下是我正在使用的代码:

SELECT realPow, timestamp 
FROM PowerData;

//To loop through the table and fetch the data for Real power
while($res = $results->fetchArray(SQLITE3_ASSOC)){
    $equal[] = $res;
}
echo json_encode($meArray,JSON_NUMERIC_CHECK);

结果:

[{"realPow":50,"timestamp":1391990400},{"realPow":200,"timestamp":1392422400},
{"realPow":100,"timestamp":1394409600},{"realPow":150,"timestamp":1395273600},
{"realPow":140,"timestamp":1397952000},{"realPow":130,"timestamp":1398384000},
{"realPow":120,"timestamp":1400544000},{"realPow":90,"timestamp":1402358400},
{"realPow":100,"timestamp":1402790400}]

我想删除“realPow:”& “时间戳”。

1 个答案:

答案 0 :(得分:-1)

以下是您修改的代码:

SELECT realPow, timestamp FROM PowerData;

    //To loop through the table and fetch the data for Real power
    while($res = $results->fetchArray(SQLITE3_ASSOC)){
        $equal[] = array($res['realPow'], $res['timestamp']);
    }
    echo json_encode($meArray,JSON_NUMERIC_CHECK);