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'] = '' mysql.init_app(app) conn = mysql.connect()


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">
                <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/>
                      <input type="text" name="surname" />
           </fieldset><br/> <br/>
               <legend>Where you live :Adress</legend>
               <label>House number:
                    <input type="text" name="housenumber"  required >
               </label><br/> <br/>
                    <input type="text" name="street" placeholder="street or avenue" required >
               </label><br/> <br/>
                    <input type="text" name="area" placeholder="eg Lefke, Guz" required >
               </label><br/> <br/>
           <br/> <br/>
                <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/>
                     <input type="email" name="email" placeholder= "eg [email protected]" required>
                </label><br/> <br/>
                <label>Phone number2:
                     <input type="tel" name="phone2" placeholder="optional"/>

        &lt;p&gt;Select your gender&lt;p&gt;
                &lt;input type="radio" name="gender" value="F"/&gt;
                &lt;input type="radio" name="gender" value="M" /&gt;
            &lt;/label&gt;&lt;br/&gt; &lt;br/&gt;
            &lt;input type="submit" vlaue="Sign up" class="lgbtn"/&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") - - [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

python mysql flask

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Best MySQL DigitalOcean Performance – ScaleGrid vs. DigitalOcean Managed Databases

Compare ScaleGrid MySQL vs. DigitalOcean Managed Databases - See which offers the best MySQL throughput, latency, and pricing on DigitalOcean across workloads.

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.

Basic Data Types in Python | Python Web Development For Beginners

In the programming world, Data types play an important role. Each Variable is stored in different data types and responsible for various functions. Python had two different objects, and They are mutable and immutable objects.

Python Flask - Introduction to Flask Templates

This is our second tutorial in Python Flask, in this tutorial we are going to have Introduction to Flask Templates, so for this Flask looks for the template

Python Flask-Mail Library to Send Emails in Browser Using Flask Full Project For Beginners

Python Flask-Mail Library to Send Emails in Browser Using Flask Full Project For Beginners #python #flask #flaskmail Welcome Folks My name is Gautam