Spaces:
Runtime error

Sql / app.py
Pezh's picture
Update app.py
8ce2017 verified
Raw History Blame Contribute Delete
567 Bytes
import streamlit as st
import requests
st.title('SQL Database Interaction')
text_input = st.text_input('Enter some text')
save_button = st.button('Save to Database')
if save_button:
url = 'https://pezhma.ir/save_data.php'
data = {'text_input': text_input}
response = requests.post(url, data=data)
if response.status_code == 200:
index = response.text # Retrieve the index from the response
st.success(f'Data saved to the database on Server B with index: {index}')#{index[:-2]}')
else:
st.error('Error saving data')