<?php
$output = '{
        "result":"success",
        "data":{
            "vertical":{
                "adds":[';
$db = new SQLite3('./.db.db');
$res = $db->query("SELECT * FROM adds");
while ($row = $res->fetchArray()) {
    $path = $row['path'];
    $orignal = $row['path'];
    $thumbpath = $row['path'];
    {
    $output.='{
                        "id":"7182",
                        "title":"tite",
                        "type":"url",
                        "link":"https:\/\/google.com",
                        "description":"testadvert",
                        "orderby":"0",
                        "position":"vertical",
                        "extension":"png",
                        "createdon":"2022-03-31 05:11:38",
                        "path": "'.$row['path'].'",
                        "orignal": "'.$orignal.'",
                        "thumbpath": "'.$thumbpath.'"
                        },';
    }
}
$x = substr($output, -1);
if($x == ",")
{
    $output=substr_replace($output,"",-1);
}
$output.='],
                    "count":1
        }
    }
}
';
echo $output;
?>
