-3

Is there any way to select a table in SQLite without printing the column headers?

The following is the code I am using:

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);

Result:

[{"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}]

I want to remove the "realPow:" & "timestamp:".

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
user3523549
  • 33
  • 1
  • 1
  • 4
  • `$equal[] = array($res['realPow'], $res['timestamp']);` – Darren Jun 26 '14 at 05:27
  • The answer is literally in the documentation. Check the parameters of [fetchArray.](http://www.php.net/manual/en/sqlite3result.fetcharray.php) – Jorg Jun 26 '14 at 05:28

1 Answers1

-1

Here is your code modified:

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);
Geseft
  • 317
  • 1
  • 7