示例#1
0
function logAPoint($pTime, $pLat, $pLong)
{
    $rsp = new JsonResponse_Basic("Problem logging point.");
    // Connect to database
    $conn = getDatabaseConnection();
    // Now create a new trip with that user id, empty notes for now
    $statement = $conn->prepare('INSERT INTO waypoints
		(trip, time, triporderindex, latitude, longitude)
		VALUES(:trid, :t, :ord, :lat, :long)');
    // Execute with given user id
    $statement->execute(array(':trid' => $_SESSION["tripid"], ':t' => $pTime, ':ord' => $_SESSION["triporderindex"], ':lat' => $pLat, ':long' => $pLong));
    // Disconnect from db
    $conn = null;
    // Increment which point you're on, be done
    $_SESSION["triporderindex"] += 1;
    $rsp->setSuccessful();
    $rsp->respondAndExit();
}