-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFFL_Query.py
More file actions
25 lines (19 loc) · 747 Bytes
/
FFL_Query.py
File metadata and controls
25 lines (19 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import mysql.connector
from time import sleep
conn = mysql.connector.connect(user = 'patrick', password = 'Password2011!', host = 'localhost', database = 'test')
cursor = conn.cursor()
while True:
brand = raw_input('what product would you like to search for?\n\n')
brand = brand.lower()
if brand == 'q' or brand == 'quit':
print 'Thank you for shopping with vArmory'
print 'Goodbye'
sleep(4)
conn.close()
break
else:
cursor.execute('SELECT * FROM inventory WHERE product like "%'+ brand + '%" ORDER BY price ASC LIMIT 100')
print '\n'
for i in cursor.fetchall():
print 'Product: ' + i[1],'// Price = ' + i[2]
print '\n\n'