<?php
$output = '<AppUpdater>';
$db = new SQLite3('./.db.db');
$res = $db->query("SELECT * FROM updates");
while ($row = $res->fetchArray()) {
    $url = $row['url'];
    $version = $row['version'];
    $version_code = $row['version_code'];
    if(!empty($url))
    {
    $output.='
<update>
<latestVersion>'.$version.'</latestVersion>
<latestVersionCode>'.$version_code.'</latestVersionCode>
<url>'.$url.'</url>
</update>
';
    }
}
$x = substr($output, -1);
if($x == ",")
{
    $output=substr_replace($output,"",-1);
}
$output.='</AppUpdater>';
echo $output;
?>