Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mysql.connector
- db = mysql.connector.connect(user="root", password="",
- host="127.0.0.1",
- database="test")
- cursor = db.cursor()
- try:
- cursor.execute('SELECT tail_number FROM aircraft')
- tail_number = cursor.fetchall()
- cursor.execute('SELECT model_number FROM model')
- model_number = cursor.fetchall()
- cursor.execute('SELECT description FROM model')
- description = cursor.fetchall()
- cursor.execute('SELECT company_name FROM companies')
- company_name = cursor.fetchall()
- cursor.execute('SELECT model_number FROM model')
- model_number = cursor.fetchall()
- cursor.execute('SELECT code FROM country_codes')
- code = cursor.fetchall()
- cursor.execute('SELECT country_name FROM country_codes')
- country_name = cursor.fetchall()
- html = """
- <table>
- <caption>European Aircraft</caption>
- <tr>
- <th>Tail Number</th>
- <th>Model Number</th>
- <th>Model Description</th>
- <th>Company Name</th>
- <th>Company Country Code</th>
- <th>Company Country</th>
- </tr>
- </table>
- <table>
- <caption>Non-European Aircraft</caption>
- <th>Tail Number</th>
- <th>Model Number</th>
- <th>Model Description</th>
- <th>Company Name</th>
- <th>Company Country Code</th>
- <th>Company Country</th>
- </tr>
- <tr></tr>
- </table>
- """
- print html
- finally:
- db.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement