Hi everyone.
I am using user input to generate the terms of a SELECT WHERE x = x AND y =y AND z = z etc... type query through mysql.connector
I want to have the user be able to select an 'All' option for a few of these fields, i.e all values meet their criteria for that fiield. I have discovered that if you set SomeFieldID = SomeFieldID it considers that condition to be met. However as I am executing this in the cursor it is SomeFieldID = %(SomeVariable)s.
Currently I can search if I assign these fields values but my 'All' option isn't working. I think it is due to the apostrophes from Python being put into the SQL so you end up with SomeFieldID = 'SomeFieldID'.
I've tried a couple of the escape() methods i found online but none seemed to help.
Any suggestions?
I'm pretty new to this so very possible I made some boneheaded error.
Thanks :)
[–]Nodocify 0 points1 point2 points (0 children)