2016-03-22 20 views
0

Müzik bilgilerimi ve albüm resmimi içeren bir tablo oluşturdum. Tabloyu oluşturmak ve görüntüleri uygulamak için Mysql ve PHP kullanıyorum. Müziğimi yine de bu tabloya nasıl yüklerim anlamıyorum? Birisi yardım edebilir mi?php ve mysql kullanarak müzik nasıl yüklerim

Çalma sütununda göstermek ve oynatmak için müziğime ihtiyacım var.

<!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> 
+0

html etiketi ses çalmak için kullanılabilir. [Buradan] (http://www.w3schools.com/tags/tag_audio.asp). Bu size yardımcı olabilir –

+0

Bu kodlamayı nereye koyardım? Ve kaydettiğim müziği koduma nasıl bağlarım? –

cevap

0

Ayrıca ses dosyası izni

düzgün ayarlanmış olduğundan emin olun bu

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> 
       <audio controls> 
        <source src='pathToAudioFile.mp3' type=\"audio/mpeg\"> 
       Your browser does not support the audio element. 
       </audio> 
      </td> 
     </tr>"; 

gibi bir şey denemek: Burada

And this is where my audio files are

Ve

As you can see, on the far right is the play column and the names of the mp3 files are in the play column as well benim kodlama olduğunu