Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
from flask import Flask
from flask import render_template
import sqlite3
con = sqlite3.connect('books0.db') #create db
con.execute('CREATE TABLE books0(id INT unsigned, name VARCHAR(255), code VARCHAR(255), image TEXT, price DOUBLE, retail DOUBLE, author VARCHAR(255), desc VARCHAR(255), quantity INT unsigned)') #create tables in db
con.close()
con = sqlite3.connect('books0.db') #connect to the db
con.execute('INSERT INTO books0(id, name, code, image, price, retail, author, desc, quantity) VALUES (1, "Harry Potter", "9787528219473", "product-images/harrypotter.jpg", 12.00, 14.00, "JK Rowling", "Book about a magical boy", 5), (2, "Sherlock Holmes", "9790560464992", "product-images/sherlock.jpg", 13.00, 15.00, "Sir Arthur", "Book about a detective and his friend", 8), (3, "The Bible", "9792355177896", "product-images/bible.jpg", 9.00, 9.00, "Unknown", "Religious Book", 7), (4, "Quran", "9786946539569", "product-images/quran.jpg", 9.00, 9.00, "Muhammad", "Religious Book", 17), (5, "Don Quixote", "9785554933462", "product-images/don.jpg", 15.00, 20.00, "Miguel de Cervantes", "Adventures of a noble", 8), (6, "The Little Prince", "9781205335333", "product-images/prince.jpg", 15.00, 20.00, "Antoine de Saint-Exupéry", "The story follows a young prince who visits various planets in space, including Earth, and addresses themes of loneliness, friendship, love, and loss.", 8), (7, "A Tale of Two Cities", "9789467953470", "product-images/cities.jpg", 13.00, 21.00, "Charles Dickens", "The novel tells the story of the French Doctor Manette", 82), (8, "The Lord of the Rings", "9792102671257", "product-images/lordoftherings.jpg", 12.00, 14.00, "John Ronald Reuel Tolkien", "Book about a magic journey through an exiting adventerous world", 51), (9, " The Dream of the Red Chamber", "9793592968117", "product-images/redchamber.jpg", 17.00, 19.00, "Cao Xueqin", "Memorial to the women from authors life", 55), (10, "The Hobbit", "9793480729226", "product-images/hobbit.jpg", 22.00, 24.00, "John Ronald Reuel Tolkien", "The quest of home-loving Bilbo Baggins", 23);')
#add the data to the db
con.commit()
con.close()