I'm creating a web app for a company that sells mp3 sound clips. I have implemented a register, login, payment and admin functions. Within the admin page I have allowed the privileged user to add an mp3 which the name will be added to a mysql database table, the actual file uploaded to an FTP server and the part I'm having problems with is displaying the newly uploaded sound clip to the corresponding page on the site. So basically every time the 'upload' button is pressed then I need a block of HTML code to be written to one of the pages on the site.
I would appreciate any guidance on where to start. I've been reading up on DOM but I don't think it's the right way to go about it. Thanks in advance
You shouldn't try to append a content to the HTML file. What will you do when your user removes the MP3 ? Remove the HTML content ? Heavy process ^^
Where you basically use your HTML file, use a PHP script which reads entries from your database. Something like...
$db = new PDO(/* database settings */);
$query = $db->query("SELECT * FROM musics");
while($result = $query->fetch(PDO::FETCH_OBJ))
{
echo $result->song_name . " by " . $result->artist;
}
This will list your songs and give that kind of output :
My Little Song by Soroush Shamsfard.
My Favourite Song by Soroush Shamsfard.
Some information about reading data from a database :