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

X-Received by 10.42.49.138 with SMTP id w10mr7097392icf.13.1404468958312; Fri, 04 Jul 2014 03:15:58 -0700 (PDT)
X-Received by 10.50.18.50 with SMTP id t18mr347061igd.10.1404468958193; Fri, 04 Jul 2014 03:15:58 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!hn18no2896813igb.0!news-out.google.com!bp9ni2744igb.0!nntp.google.com!uq10no1441480igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Fri, 4 Jul 2014 03:15:57 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=125.227.248.66; posting-account=pJ7uNAoAAAAHwdz2gtW7xXFmZBh0Iyco
NNTP-Posting-Host 125.227.248.66
User-Agent G2/1.0
MIME-Version 1.0
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>
Injection-Date Fri, 04 Jul 2014 10:15:58 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:73945

Show key headers only | 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