-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsenddata.php
35 lines (30 loc) · 1008 Bytes
/
senddata.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "mymusic";
$name = $_POST['name'];
$title = $_POST['title'];
$tempo = $_POST['tempo'];
$energy = $_POST['energy'];
$danceability = $_POST['danceability'];
$loudness = $_POST['loudness'];
$valence = $_POST['valence'];
$acousticness = $_POST['acousticness'];
$mood = $_POST['mood'];
$file = $_POST['file'];
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "INSERT INTO data (name, title, tempo, energy, danceability, loudness, valence, acousticness, mood, file)
VALUES ('$name', '$title', '$tempo', '$energy', '$danceability', '$loudness', '$valence', '$acousticness', '$mood', '$file')";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>