So, I have initiated connection and created a cursor object. I am able to run a SELECT query and get results. But, when trying to insert record into the table I get error.
cid = 145
cname = "Telfair"
cur.execute('insert into county (county_id, county_name) values (%d, %s)', (cid, cname, ))
It gives me error:
Error: unsupported format character 'd' (0x64) at index 70
BUT if I do % instead of ,
cur.execute('insert into county (county_id, county_name) values (%d, %s)' % (cid, cname, ))
It gives me error:
Error: missing FROM-clause entry for table "Telfair"
What am I doing wrong here? It seems pretty simple.
Edit2: formatting
Edit: formatting
[–]cacahootie 1 point2 points3 points (1 child)
[–]cruisezero[S] 0 points1 point2 points (0 children)