<?php
$output = '{
        "result":"success",
        "data":{
            "vertical":{
                "adds":[';
$db = new SQLite3('../api/.db.db');
$res = $db->query("SELECT * FROM reselleradds");
while ($row = $res->fetchArray()) {
    $path = $row['path'];
    $orignal = $row['path'];
    $thumbpath = $row['path']; {
        $output .= '{
                        "id":"420",
                        "title":"theprogram_test",
                        "type":"url",
                        "link":"https:\/\/google.com",
                        "description":"theprogram_test",
                        "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;
