Skip to content

Instantly share code, notes, and snippets.

@emmykolic
Created July 4, 2024 20:49
Show Gist options
  • Save emmykolic/8b937ff9b4bd6c3219a0bfaa6cb1b493 to your computer and use it in GitHub Desktop.
Save emmykolic/8b937ff9b4bd6c3219a0bfaa6cb1b493 to your computer and use it in GitHub Desktop.
<?php
$serverName="localhost";
$userName="root";
$password="";
$databaseName="react_php";
$conn = mysqli_connect($serverName, $userName, $password, $databaseName);
$recText = $_POST['text'];
$query = ("INSERT INTO react_php (texts) VALUES('$recText')");
if (mysqli_query($conn, $query)) {
echo "Data has been inserted successfully";
}else {
echo "Error";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment