The right syntax to use near '''?
<p>I am running a Python bot which connects to a SQL database and updates values in tables.</p>

<p>I have the following code:</p>

<p><code>mycursor.execute("SELECT * FROM reputation WHERE username = '" + str(critiquer) + "'")</code></p>

<p>I am receiving the error "...check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 1"</p>

<p>I've done some debugging and there is no problem with the string "critiquer," and the row exists in the table.</p>

<p>Would appreciate some insight into this problem.</p>

<p>Try using a parametrized query:</p>

<pre><code>mycursor.execute("SELECT * FROM reputation WHERE username = '?'", critiquer)
</code></pre>

python mysql