Hi,
When I use an integer as variable in my SQL query it works as it should. However if work with a string It does not work, I don't get an error message but also not results.
THis is the code that works (with variable as integer)
any tips on what I do wrong?
When I use an integer as variable in my SQL query it works as it should. However if work with a string It does not work, I don't get an error message but also not results.
THis is the code that works (with variable as integer)
import psycopg2 as p conn = p.connect ("dbname='participants_db' user='postgres' host= 'localhost'") cur = conn.cursor() x = 5 cur.execute("UPDATE participants SET participant_paid = 'Yes' WHERE participant_id = '%s'", [x]) conn.commit()If I change the variable to a string and change my query to %%S instead of %, I don't get an error message but also no results
x = ('Cleavon') cur.execute("UPDATE participants SET participant_paid = 'Yes' WHERE participant_name = '%%s'", [x])
any tips on what I do wrong?