Download save_data.php from Pezh/Sql: direct link, hf CLI and curl.
- Browser
- Download file 591 Bytes
-
https://huggingface.co/spaces/Pezh/Sql/resolve/main/save_data.php
- Command line
-
hf download hf://spaces/Pezh/Sql/save_data.php
-
curl -L -o save_data.php https://huggingface.co/spaces/Pezh/Sql/resolve/main/save_data.php
591 Bytes
| $servername = "localhost"; | |
| $username = "username"; | |
| $password = "password"; | |
| $dbname = "database"; | |
| $conn = new mysqli($servername, $username, $password, $dbname); | |
| if ($conn->connect_error) { | |
| die("Connection failed: " . $conn->connect_error); | |
| } | |
| if ($_SERVER['REQUEST_METHOD'] == 'POST') { | |
| $text_input = $_POST['text_input']; | |
| $sql = "INSERT INTO text_data (text) VALUES ('$text_input')"; | |
| if ($conn->query($sql) === TRUE) { | |
| echo "Record saved successfully"; | |
| } else { | |
| echo "Error: " . $sql . "<br>" . $conn->error; | |
| } | |
| } | |
| $conn->close(); | |