简体   繁体   中英

Python MySQL database, data update error?

In the Python software language, the str variant gives an error when adding to the MySQL database. To me, this is the problem of character. Could you help?

The lines of code I wrote are at the bottom.

rezerve='Aşkım Nasılsın?'
new_status = telStatus + 1
try:
    tablo_birak = "UPDATE denemetablodd SET status='%s', rezerve='%s' WHERE ıd=1" % (str(new_status), str(rezerve))
    imlec.execute(tablo_birak)
    mysqlBaglanti.commit()
except:
    mysqlBaglanti.rollback()

Your problem is that you are not using values which are on an ascii chart. Many programs only use symbols which are in the first 128 ascii values ( http://www.asciitable.com/index/asciifull.gif ). Characters such as the S with the line below it are not accepted by these programs. Although I understand these may be a part of this language, my best advice would be to change these to the closest english alphabet approximation otherwise you will not be able to use this version of mySQL. Perhaps make the value of $rezerve into "Askim Nasilsin?" if you want to be able to use mySQL.

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