1
私はPyMySQLとPythonを使っています。Python - 私のMySQLクエリのエラーはどこですか?
sql = "INSERT INTO accounts(date_string, d_day, d_month, d_year, trans_type, descriptor, inputs, outputs, balance, owner) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', AES_ENCRYPT('%s', 'example_key_str')"
cur.execute(sql % (date, d_day, d_month, d_year, ttype, desc, money_in, money_out, bal, owner))
これは、曖昧な構文エラーをスローし、どのように修正するかわかりません。評価されたクエリは次のとおりです。
INSERT INTO accounts(date_string, d_day, d_month, d_year, trans_type, descriptor, inputs, outputs, balance, owner) VALUES ('12 Feb 2012', '12', 'Feb', '2012', 'CHQ', 'CHQ 54', '7143.78', '0.00', '10853.96', AES_ENCRYPT('[email protected]', 'example_key_str')
MySQLのエラーは次のとおりです。
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 '' at line 1
すべてのヘルプははるかに高く評価されるだろう。前もって感謝します。
ありがとうございます!私たちはすべて今ソートされています。 – Alex