Forum Moderators: coopster
<?php
echo '<a href="http://yourwebsite.tld/files/mp3/'.$mp3filename.'" title="'.$mp3filename.'">'.$mp3filename.'</a>';
?>
Granted, everyone in the world will know where you store your mp3s on your server and may hotlink to them unless you deny hotlinking.
btw if you do not want your users to see your actual audio files folder, so that they can MISUSE your server resources e.g linking to your audio files directly from their websites wasting your bandwidth etc etc, then use a flash player you can download one for free from FlashKit.com movies section there are many free contributed by members or you can develop your own.
the idea will be to load audio files in the flash player in real time from the audio folder, block direct access to that folder and hot-linking too.
ie <a href="folder1/folder2/nameOfFile.extension"></a> However with php you can type
<?php echo "<a href=\"folder1/folder2/".$variableOfFileLocation."\"></a>"
?>
or even
<a href="folder1/folder2/<?php echo $row_database['fileLocation'];?>"></a>
Of coures you have to create a mysql query and define the variable that calls the filelocation....
If you can post the code you are currently using, I think it would help the explination so we can use your code as the example...
tim
Not true. Using the code I gave, which surrounded the statement in 'single quotes', you don't have to slash the "double quotes". You would have to slash 'single quotes' if there were any in the statement though.
FYI: Any time you enclose a statement in double quotes in php, your telling php "there may be variables in this statement so look closely while you parse through here". It can be inefficient.