Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Check Examples
- #python 2.7.15
- print "Hello, Dcoder!"
- import mysql.connector
- from datetime import datetime
- mydb = mysql.connector.connect(
- host="localhost",
- user="yourusername",
- passwd="yourpassword",
- database="mydatabase"
- )
- mycursor = mydb.cursor()
- mycursor.execute("SElECT * FROM `registration` WHERE `key`");
- row_count = mycursor.rowcount();
- if row_count = 1 :
- row = mycursor.fetchone()
- if row.status = "ACTIVE" :
- if row.validity > datetime.timestamp(datetime.now()) :
- for r in rows :
- r[0];
- r[1];
- r[2];
- for x in mycursor:
- print(x)
- def validate_request(key):
- mydb = mysql.connector.connect(
- host="localhost",
- user="yourusername",
- passwd="yourpassword",
- database="mydatabase"
- )
- mycursor = mydb.cursor()
- mycursor.execute("SElECT * FROM `registration` WHERE `key`");
- row_count = mycursor.rowcount();
- if row_count = 1 :
- row = mycursor.fetchone()
- if row.status = "ACTIVE" :
- if row.validity > datetime.timestamp(datetime.now()) :
- for r in rows :
- r[0];
- r[1];
- r[2];
- for x in mycursor:
- print(x)
- #schema
- Table name
- registration
- key
- reg_date
- expiry_date
- name
- email_id
- active_status
- services
- email_id
- spam_predictor
Add Comment
Please, Sign In to add comment