简体   繁体   中英

Insert marker from leaflet map to database

I am trying to insert a point into my sqlite database. I have created a marker on my map, that opens a popup where I can type in an adress and send it via post request to the database, however the statement does not create a new row with the given x,y and adress data. Here is my code:

@app.route('/marker', methods=['POST'])
def draw():
    conn = g.db.cursor()
    x = request.form['x']
    y = request.form['y']
    desc = request.args['desc']
    conn.execute('''INSERT INTO my_table(id, adress, geom) VALUES (1111111, '%s', GeomFromText('POINT(%s %s)', 3857))''' % (desc, x, y))
    result = conn.fetchall()
    return result

The INSERT statement does not return anything.

To read data from the database, you must use a SELECT query.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM