title: Flask and Python how to make search engine for data from mysql database
body: <p>I want to make some kind of search engine for student's information by entering their first name in html input field, but I have some troubles with my code. I am using Flask with Python though. 
  Here is my project.py code:</p>
  
  <pre><code>@app.route('/search', methods=['GET', 'POST'])
  def search():
      if request.method == "POST":
          db = MySQLdb.connect(user="root", passwd="", db="cs324", host="127.0.0.1")
          c=db.cursor()
          c.executemany('''select * from student where name = %s''', request.form['search'])
          for r in c.fetchall():
              print r[0],r[1],r[2]
              return redirect(url_for('search'))
      return render_template('search.html')
  </code></pre>
  
  <p>Here is my search.html code:</p>
  
  <pre><code>{% extends "hello.html" %}
  {% block content %}
  &lt;div class="search"&gt;
  &lt;form action="" method=post&gt;
      &lt;input type=text name=search value="{{ request.form.search}}"&gt;&lt;/br&gt;
      &lt;div class="actions"&gt;&lt;input type=submit value="Search"&gt;&lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  {% for message in get_flashed_messages() %}
  &lt;div class=flash&gt;
      {{ message }}
  &lt;/div&gt;
  {% endfor %}
  {% endblock %}
  </code></pre>
  
  <p>When I hit Search button nothing happens, I checked database it has some data in it so it is not empty, I can't find where am I making a mistake, please help?</p>