FLASK mysqlsserver connection complex

FLASK mysqlsserver connection complex

Salutation to all python and flask developers I am trying to create an app in flask which registration isnt working 1 the main app

Salutation to all python and flask developers I am trying to create an app in flask which registration isnt working 1 the main app

from flaskext.mysql import MySQL
app = Flask(__name__,static_url_path='/static')

mysql= MySQL() app.config['MYSQL_DATABASE_USER'] = 'root' app.config['MYSQL_DATABASE_PASSWORD'] = 'Nimnam*7' app.config['MYSQL_DATABASE_DB'] = 'store' app.config['MYSQL_DATABASE_HOST'] = '127.0.0.1' mysql.init_app(app) conn = mysql.connect()

@app.route('/')

def hello_world(): return render_template('home.html')

@app.route('/signup/', methods=['GET','POST']) def registeruser(): if request.method == 'POST': cursor = conn.cursor() firstname= request.form.get('firstname') secondname=request.form.get('secondname') surname=request.form.get('surname') email=request.form.get('email') password=request.form.get('password') gender=request.form.get('gender') cursor.execute("insert into store.user values (%s,%s,%s,%s,%s,%s)"%(firstname,secondname,surname,email,password,gender)) cursor.commit() housenumber = request.form.get('housenumber') street = request.form.get('street') area= request.form.get('area') phonenumber1 = request.form.get('phone1') phonenumber2 = request.form.get('phone2') cursor.execute("insert into store.contact values (%s,%s,%s,%s,%s,%s)"%(phonenumber1,email,housenumber,street,area,phonenumber2)) cursor.commit() return "weldone you are registerd" return render_template('signup.html')

if name == 'main': app.run()

Now here is the form ,the signup.html template

  <h1>We are pleased to have you join our community </h1>
      <p>There are only three essential things we need to know about you our dear customer so that you make the best of our services</p>
      <p>Currently we are operating in lefke Gemikonagi and Guzelyurt</p>
      <h2>Where you live </h2>
       <form action='/signup/' method="post">
           <fieldset>
                <legend>Identity: who you are</legend>
                <label>First name:
                     <input type="text" name="firstname" required>
                </label><br/> <br/>
                <label>Second name:
                     <input type="text" name="secondname" />
                </label><br/> <br/>
                <label>Surname:
                      <input type="text" name="surname" />
                </label>
           </fieldset><br/> <br/>
           <fieldset>
               <legend>Where you live :Adress</legend>
               <label>House number:
                    <input type="text" name="housenumber"  required >
               </label><br/> <br/>
               <label>Street:
                    <input type="text" name="street" placeholder="street or avenue" required >
               </label><br/> <br/>
               <label>Area:
                    <input type="text" name="area" placeholder="eg Lefke, Guz" required >
               </label><br/> <br/>
           </fieldset>
           <br/> <br/>
           <fieldset>
                <legend>Contact details</legend>
                <label>Phone number:
                     <input type="tel" name="phone1" pattern="[0-9]{4}-[0-9]{3}-[0-9]{4}" placeholder="Telsim or Turkcell" required>
                      <span class="note">Format: 1234-456-7890</span>
                </label><br/> <br/>
                <label>Email:
                     <input type="email" name="email" placeholder= "eg [email protected]" required>
                </label><br/> <br/>
                <label>Phone number2:
                     <input type="tel" name="phone2" placeholder="optional"/>
                </label>

       &lt;/fieldset&gt;
        &lt;p&gt;Select your gender&lt;p&gt;
            &lt;label&gt;
                &lt;input type="radio" name="gender" value="F"/&gt;
             Male
            &lt;/label&gt;
            &lt;label&gt;
                &lt;input type="radio" name="gender" value="M" /&gt;
                Female
            &lt;/label&gt;&lt;br/&gt; &lt;br/&gt;
            &lt;input type="submit" vlaue="Sign up" class="lgbtn"/&gt;

    &lt;/form&gt;

The database is well connected and I havent noticed anything that coul be wrong with the tables Im using mysql but when I try to fill my own froms to put data into db i meet this weird error

pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax;  check the manual that corresponds to your MySQL server version for the right syntax to use near '@gmail.com,None,F)' at line 1")

127.0.0.1 - - [01/Feb/2019 01:10:08] "POST /signup/ HTTP/1.1" 500 - any answer will be an eye opener and will be greatly appreciated I am a beginner

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Python Flask & MySQL REST API con SQLAlchemy

En este ejemplo Práctico de Python vamos a aprender a crear una REST API usando Flask y MySQL a través de un modulo llamado SQLAlchemy, el cual nos permitira interactuar con la base de datos de mysql.

Python Flask for Beginners: Build a CRUD Web App with Python and Flask

In this Python Flask tutorial, you'll learn to build CRUD web applications using Python and Flask. Python and Flask can make building a CRUD app super easy.

Aprender Python, Django, Flask, Tkinter, POO, SQLite, MySQL y MÁS 🐍

Aprender Python, Django, Flask, Tkinter, POO, SQLite, MySQL y MÁS 🐍 POO, Programación Orientada a Objetos en Python. Bases de datos SQL, trabajando en conjunto con nuestros desarrollos. Tkinter, para crear aplicaciones de escritorio con interfaz gráfica. Django, el framework de desarrollo web para Python más popular y demandado por las empresas. Flask, el moderno framework para desarrollar aplicaciones web.