// Open a new sqlite3 DB
$db = new SQLite3('./DB_EHLH.db');
// select all information from table "algorithm"
$results= $db->query("select * from algorithm");
//Create array to keep all results
$data= array();
// Fetch Associated Array (1 for SQLITE3_ASSOC)
while ($res= $results->fetchArray(1))
{
//insert row into array
array_push($data, $res);
}
//you can return a JSON array
echo json_encode($data);
//the output is a s follows
[
{"id":1,"algorithm":"GA"},
{"id":2,"algorithm":"PSO"},
{"id":3,"algorithm":"IWO"},
{"id":4,"algorithm":"OIWO"}
]