注册 登录
编程论坛 Python论坛

代码报错解决不了了

wuhuiiii 发布于 2013-03-29 20:52, 1608 次点击
cmd='SELECT `card` FROM  `userdata` WHERE `card` = %s'%card#命令:在数据库搜索刚刚输入的卡号
     passwordmd=md5.new()
     passwordmd.update(password)
 if userdbcmd(cmd)==0:         #没有找到相同的卡号
     self.response.write(r"""<a>卡号错误<a><p><a href="/">返回<p>""")
     raise UserError
 else:
     cmd1='SELECT `password_1` FROM  `userdata` WHERE `password_1` = %s'%password  #命令:在数据库搜索刚刚输入的密码
     if userdbcmd(cmd1)==0:           #没有找到相同的密码
         self.response.write(r"""<a>密码错误<a><p><a href="/">返回<p>""")
     else:
         self.response.write(r"""<a>登录成功<a><p><a href="/">返回<p>""")
 except UserError:
            pass
会报错:
Traceback (most recent call last):
  File "/home/bae/instanceall/instance0/pyruntime/lib/python2.7/site-packages/webapp2.py", line 1536, in __call__
    rv = self.handle_exception(request, response, e)
  File "/home/bae/instanceall/instance0/pyruntime/lib/python2.7/site-packages/webapp2.py", line 1530, in __call__
    rv = self.router.dispatch(request, response)
  File "/home/bae/instanceall/instance0/pyruntime/lib/python2.7/site-packages/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/home/bae/instanceall/instance0/pyruntime/lib/python2.7/site-packages/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/home/bae/instanceall/instance0/pyruntime/lib/python2.7/site-packages/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/home/bae/instanceall/instance0/pyruntime/lib/python2.7/site-packages/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "/home/bae/instanceall/instance0/codefs/0.fanxianle., line 82, in post
    userdbcmd(cmd3,1)
  File "/home/bae/instanceall/instance0/codefs/0.fanxianle., line 23, in userdbcmd
    cursor.execute(cmd)
  File "/home/bae/instanceall/instance0/pyruntime/lib/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/home/bae/instanceall/instance0/pyruntime/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''password','card', `gender`,  `iffanxian`, `address`,'ifzhuce') VALUES ('guo', '1' at line 1")

[ 本帖最后由 wuhuiiii 于 2013-4-19 23:28 编辑 ]
2 回复
#2
evilloop2013-04-10 16:19
楼主,你不把报错信息发全了怎么看
#3
wuhuiiii2013-04-19 23:31
回复 2楼 evilloop
不好意思,之前一直在忙,现在把错误都贴出来了,主要是我想只在指定列插入值,其他列的值保持不变。谢谢你了先
1