Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73945

flask sql cann't insert Variable in VALUES

Newsgroups comp.lang.python
Date 2014-07-04 03:15 -0700
Message-ID <a0d60918-2ddd-4b04-abd1-e3ce98d2e1ea@googlegroups.com> (permalink)
Subject flask sql cann't insert Variable in VALUES
From Frank Liou <fk26541598fk@gmail.com>

Show all headers | View raw


I try to insert username in to my table

it show

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

it maybe mean no request

i try to change username to '123123'

then it works....

what's problem with this?



@app.route('/user/<username>',methods=['GET','POST'])
def hello(username):
        if request.method=='POST':
            save_friends(username)
            return username


def save_friends(username):
    conn = engine.connect()
    conn.execute("INSERT INTO friends(name) VALUES(username)")

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

flask sql cann't insert Variable in VALUES Frank Liou <fk26541598fk@gmail.com> - 2014-07-04 03:15 -0700
  Re: flask sql cann't insert Variable in VALUES Chris Angelico <rosuav@gmail.com> - 2014-07-04 20:24 +1000
    Re: flask sql cann't insert Variable in VALUES Frank Liou <fk26541598fk@gmail.com> - 2014-07-06 19:18 -0700

csiph-web