Muxammad al-xorazmiy nomidagi toshkent axborot texnologiyalari universiteti urganch


return redirect(url_for('customers'))



Download 416,45 Kb.
bet10/16
Sana08.06.2023
Hajmi416,45 Kb.
#949730
1   ...   6   7   8   9   10   11   12   13   ...   16
Bog'liq
G.Taxirova individual 2

return redirect(url_for('customers'))
cur = mysql.connection.cursor()
cur.execute("DELETE FROM `customers` WHERE id=%s", (idn))
mysql.connection.commit()
flash("Ma'lumot muvaffaqiyatli o'chirildi")
return redirect(url_for('customers'))


@app.route('/products', methods=['POST','GET'])
def products() :
cur=mysql.connection.cursor()
sql="SELECT * FROM `types`"
cur.execute(sql)
types = cur.fetchall()
if request.method=="POST" :
cur = mysql.connection.cursor()
search=request.form['search']
sql="SELECT ice_cream.id, ice_cream.name, ice_cream.price,types.type FROM ice_cream INNER JOIN types ON ice_cream.type_id=types.id WHERE `ice_cream`.`name` LIKE '%"+search+"%' OR `types`.`type` LIKE '%"+search+"%' ORDER BY ice_cream.id ASC"
cur.execute(sql)
data=cur.fetchall()
cur.close()
return render_template('products.html',products=data,types=types)
cur=mysql.connection.cursor()
sql="SELECT ice_cream.id, ice_cream.name, ice_cream.price,types.type FROM ice_cream INNER JOIN types ON ice_cream.type_id=types.id ORDER BY ice_cream.id ASC;"
cur.execute(sql)
data = cur.fetchall()
cur.close()
return render_template('products.html',products=data,types=types)


@app.route('/products/insert_type', methods = ['POST'])
def add_type():
if request.method == "POST":
data = request.form['name']
cur = mysql.connection.cursor()
cur.execute("INSERT INTO `types` (id, type) VALUES (%s, %s)", ('NULL',data))
mysql.connection.commit()
cur.close()
flash("Ma'lumotlar muvaffaqiyatli kiritildi")
return redirect(url_for('products'))



Download 416,45 Kb.

Do'stlaringiz bilan baham:
1   ...   6   7   8   9   10   11   12   13   ...   16




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish