Commit
·
66957d1
1
Parent(s):
96262b5
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ def main():
|
|
45 |
name=st.text_input("Enter Name")
|
46 |
email=st.text_input("Enter Email")
|
47 |
if st.button("Create"):
|
48 |
-
sql= "insert into
|
49 |
val= (name,email)
|
50 |
mycursor.execute(sql,val)
|
51 |
mydb.commit()
|
@@ -55,7 +55,7 @@ def main():
|
|
55 |
|
56 |
elif option=="Read":
|
57 |
st.subheader("Read Records")
|
58 |
-
mycursor.execute("select * from
|
59 |
result = mycursor.fetchall()
|
60 |
for row in result:
|
61 |
st.write(row)
|
@@ -67,8 +67,8 @@ def main():
|
|
67 |
name=st.text_input("Enter Name")
|
68 |
email=st.text_input("Enter New Email")
|
69 |
if st.button("Update"):
|
70 |
-
sql="update
|
71 |
-
val=(name,email)
|
72 |
mycursor.execute(sql)
|
73 |
mydb.commit()
|
74 |
st.success("Record Updated Successfully!!!")
|
|
|
45 |
name=st.text_input("Enter Name")
|
46 |
email=st.text_input("Enter Email")
|
47 |
if st.button("Create"):
|
48 |
+
sql= "insert into users2(name,email) values(%s,%s)"
|
49 |
val= (name,email)
|
50 |
mycursor.execute(sql,val)
|
51 |
mydb.commit()
|
|
|
55 |
|
56 |
elif option=="Read":
|
57 |
st.subheader("Read Records")
|
58 |
+
mycursor.execute("select * from users2")
|
59 |
result = mycursor.fetchall()
|
60 |
for row in result:
|
61 |
st.write(row)
|
|
|
67 |
name=st.text_input("Enter Name")
|
68 |
email=st.text_input("Enter New Email")
|
69 |
if st.button("Update"):
|
70 |
+
sql="update users2 set email=%s, email=%s where id=%s"
|
71 |
+
val=(name,email, id)
|
72 |
mycursor.execute(sql)
|
73 |
mydb.commit()
|
74 |
st.success("Record Updated Successfully!!!")
|