Python connectivity problem as Query problem in mini projects

Error due to this line pl give me correction suggestion for this in my mini project

cur.execute("update worker set salary=salary+"+n_salary+" where name like '%esh%'"+name+';')

Error Message in Project
Traceback (most recent call last):
File “C:\Program Files\Python310\lib\site-packages\mysql\connector\connection_cext.py”, line 523, in cmd_query
self._cmysql.query(query,
_mysql_connector.MySQLInterfaceError: 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 ‘Ram’ at line 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\pc\BMS.py”, line 157, in
up()
File “C:\Users\pc\BMS.py”, line 138, in up
cur.execute(“update worker set salary=salary+”+n_salary+" where name like ‘%esh%’"+name+‘;’)
File “C:\Program Files\Python310\lib\site-packages\mysql\connector\cursor_cext.py”, line 269, in execute
result = self._cnx.cmd_query(stmt, raw=self._raw,
File “C:\Program Files\Python310\lib\site-packages\mysql\connector\connection_cext.py”, line 528, in cmd_query
raise errors.get_mysql_exception(exc.errno, msg=exc.msg,
mysql.connector.errors.ProgrammingError: 1064 (42000): 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 ‘Ram’ at line 1

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.