So basically I want to fetch a youtube video id in PHP from URL and put it into a MySQL table, how can I achieve that?
I have this for the moment : (note that the fetched id is define by $vidid)
<?php
$conn = mysqli_connect('localhost', 'root', '', 'test');
if (!$conn) {
die("Error connecting to database: " . mysqli_connect_error($conn));
exit();
}
// sql to create table
$sql = "CREATE TABLE vidid (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
)";
if ($conn->query($sql) === TRUE) {
echo "Table vidid created successfully";
} else {
echo "Error creating table: " . $conn->error;
}
$conn->close();
?>