【发布时间】:2016-07-08 22:34:04
【问题描述】:
我已经通过 xampp 在 phpmyadmin 上创建了一个数据库。我目前正在尝试制作一个音乐播放器,但我很难将我的音乐文件夹链接到我的 php 编码。我不知道正确的语法或我应该在我的编码中工作的位置以实现音乐播放器。
And this is where all my music is stored
请有人帮助我,拜托..1
这也是我的编码
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "jukebox";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM Music";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table>
<tr>
<th>Artist</th>
<th>Title</th>
<th>Album</th>
<th>Albumcover</th>
<th>Play</th>
</tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo
"<tr>
<td>" . $row["Artist"]. "</td>
<td>" . $row["Title"]. "</td>
<td>" . $row["Album"]. "</td>
<td><img src='/jukebox/img/" . $row["Albumcover"] ."' alt=".$row["Albumcover"]."></td>
<td>" . $row["Play"] . "></td>
</tr>";
}
echo "</table>";
} else {
echo "0 results";
}
?>
</body>
</html>
【问题讨论】:
-
您将使用您的音乐列表创建一个音乐播放器,对吗?我认为,这将是很多工作要做。你必须有一个可用的 css、jquery、插件和任何有帮助的东西。看看这个 [stackoverflow.com/questions/5102137/…