how to store audio files path in mysql database table

632 views
Skip to first unread message

Aqeel Arcade

unread,
Jun 25, 2015, 10:47:09 AM6/25/15
to jpl...@googlegroups.com
i am struggling to store mp3 files URL/path in my songs table url field. i am using xampp and mysql with phpmyadmin since i have very little knowledge about sql i have no idea how exactly i should refer my mp3 files path to songs table field! my mp3 files are located in Local drive E and this is the address of one of my mp3 file

E:\Entertainment Lib\Music Library\The Beatles\The Beatles A Hard Day's Night\If I Fell.mp3
 but after putting it in database table it doesn't work for me. screenshot of my database table is here-plz check this and finally this is the script that i used to fetch random song from my database table
<?php

 
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){

include_once
"ez_sql_core.php";
include_once
"ez_sql_mysql.php";
$db
= new ezSQL_mysql('root','','test','localhost');

$song
= $db->get_row("SELECT * FROM songs ORDER BY RAND() LIMIT 1");

$artist
= $song->artist;
$songname
= $song->title;
$url
= $song->url;
$separator
= '|';
echo $url
.$separator.$artist.$separator.$songname;
}

?>
<script type="text/javascript">
$
(document).ready(function(){
$
("#jquery_jplayer_1").jPlayer({
    ready
: function () {
       
var data = $.ajax({
          url
: "/js/getsong.php",
          async
: false
         
}).responseText;

       
var string = data.split('|');
        $
(this).jPlayer("setMedia", {
            mp3
: string[0]
       
}).jPlayer("play");

        $
('#artist').html(string[1]);
        $
('#songname').html(string[2]);
   
},
    ended
: function (event) {  
       
var data = $.ajax({
          url
: "/js/getsong.php",
          async
: false
         
}).responseText;

       
var string = data.split('|');
        $
(this).jPlayer("setMedia", {
            mp3
: string[0]
       
}).jPlayer("play");

        $
('#Miaow').html(string[1]);
        $
('#Hidden').html(string[2]);
   
},
    swfPath
: "js/jPlayer",
    supplied
: "mp3"
 
});
});
</script>

i will be very thankful to the person who will helps me to solve this problem.
Reply all
Reply to author
Forward
0 new messages