Newer
Older
GpsTracker / servers / php / getroutes.php
@Nick Fox Nick Fox on 14 Mar 2014 733 bytes removed php_info file
<?php
    include 'dbconnect.php';

    $query = 'CALL prcGetRoutes();';

    $json = '{ "routes": [';

    // execute query
    if ($mysqli->multi_query($query)) {

        do {  // build our json array
            if ($result = $mysqli->store_result()) {
                while ($row = $result->fetch_row()) {
                    $json .= $row[0];
                    $json .= ',';
                }
                $result->close();
            }
        } while ($mysqli->next_result());
    }
    else {
        die('error: '  . $mysqli->error);
    }
    
    $json = rtrim($json, ",");
    $json .= '] }';

    header('Content-Type: application/json');
    echo $json;

    $mysqli->close();
?>