你好,我有更奇怪的问题 在CentOS上使用Python版本2.6.6和MYSQLdb API版本(1,2,3,'gamma',1) 当我想更新/插入一些数据到一个表蟒蛇返回我1(真),但没有在MySQL的数据,当我把同样的查询在phpMyAdmin,一切正常Python 2.6.6,MYSQLdb不会插入/更新
这里是代码
import MySQLdb
# make mysql connection
try:
db = MySQLdb.connect(host="192.168.0.*", port=3366, user="*", passwd="*", db="*")
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
exit()
sql = cursor.execute("INSERT INTO `video` SET `title`='testera', `description`='', `featuredesc`='', `keyword`='', `location`='', `embed_code`='', `vPath`='', `vSize`='0', `vText`='', `videoUrl`='', `mod_filestatus`='', `mod_mode`='', `mod_external`=''")
print sql # giving me 1
因此,没有错误,一切正常,只是不在db中,而db/tabel/fields存在。 怎么办,我没有想法。
这将帮助,如果你向我们展示了实际的代码,而不是其近似。 – NPE