title: How do you read individual values from the same row in a database with sqlite?
body: <p>I am attempting to read 2 values from the same row in a database but I am only good enough to read the entire line at once. I have added all the code that I think will be relevant:</p>
  
  <pre><code>    def find(search, term):
          # Helper function for the find function.
          with connect("GTINb.db") as db:
              cursor = db.cursor()
              sql = "select * from GTINb where {} = ?".format(search)
              cursor.execute(sql,(term,))
              db.commit()
              results = cursor.fetchall()
              new = str(term)
              if results:
                  results = str(results)
                  temp = open('temp.txt', 'a')
                  temp.write(results)
                  temp.write('\n')
                  temp.close()
                  with connect("GTINb.db") as db:
                      cursor.execute("UPDATE GTINb SET stockcur=stockcur-1 WHERE GTIN8=(?)",(new,))
                      cur = cursor.execute("SELECT stockcur from GTINb by (?)",(new,))
                      re = cursor.execute("SELECT restock from GTINb by (?)",(new,))
                      if cur &lt; re:
                          cursor.execute("UPDATE GTINb SET stockcur=stockcur+10 WHERE GTIN8=(?)",(new,))
                          return print('More stock has been ordered in as stocks were low')
                      else:
                          return
              else:
                  temp = open('temp.txt', 'a')
                  temp.write('Product not found')
                  temp.write('\n')
                  temp.close()
                  return 
  </code></pre>
  
  <p>I am currently getting the error <code>sqlite3.OperationalError: near "(": syntax error</code>, and have tried replacing the '(?)' with %s, (%s) and ? with no success, coming up with the following error messages: </p>
  
  <pre><code>sqlite3.OperationalError: near "12345670": syntax error // where 12345670 was the input represented by new
  sqlite3.OperationalError: near "(": syntax error 
  sqlite3.OperationalError: near "?": syntax error 
  </code></pre>
  
  <p>Is there another way of doing this or have I made a simple mistake?</p>