title: How to compare input value with mysql database value in python
body: <p>So I want to compare the input value with my database value. IF the input value is the same value as the database, I want to  <code>print(inputvalue)</code>. But if it's not the same, I want to <code>print("Data Does Not Exist")</code></p>
  
  <p>So I've tried this code :</p>
  
  <pre><code>cur = connection.cursor()
  query = """ SELECT * FROM `foo` """
  
  cur.execute(query)
  result = cur.fetchall()
  inputvalue = input("Input= ")
  
  for x in result:
      if inputvalue not in x:
          print("Data Does Not Exist")
      else:
          print(inputvalue)
  </code></pre>
  
  <p>and this is the output:</p>
  
  <pre><code>inputvalue= 1728192
  Data Does Not Exist
  Data Does Not Exist
  Data Does Not Exist
  Data Does Not Exist
  1728192
  Data Does Not Exist
  Data Does Not Exist
  Data Does Not Exist
  </code></pre>
  
  <p>I expect the output is </p>
  
  <pre><code>Inputvalue= 1728192
  Data Does Not Exist
  </code></pre>
  
  <p><strong>If the Data Does Not Exist</strong>,
  And this output: </p>
  
  <pre><code>Inputvalue= 1728192
  1728192
  </code></pre>
  
  <p><strong>If the Data Exist</strong><br/>
  Any answer would be appreciated!</p>