0

I was wondering if anyone could tell me how I would approach building a music search engine using php and mysql. I have a design for my Music search engine which I did using html css on Dreamweaver and I have some mp3/audio files on my computer and all i need to know is how to insert/retrieve the audio files into/from the mysql database and play it on my search engine at the user's request. Please if anyone could point me in the right direction or recommend some useful resources that could help me i would very much appreciate it.

Also if there are free scripts that you could recommend that I could use that would be helpful aswell.

Edited by pritaeas: Moved to PHP.

4
Contributors
4
Replies
30
Views
2 Years
Discussion Span
Last Post by diafol
0

mysqli_query("SELECT * FROM musicListThingie WHERE trackTag LIKE '" . $_GET["tracknames"] . "'");

If you already know how to retrieve data, fetch them, display them, the query I provided above is actually all you need. Of course, you need to change this one-liner for couple things.

More about this here. These are called wildcards which are quite essential on your mission. They help you to decide how queries should be distiniguished (conditioning), which spaces should be filled etc.

Edited by Aeonix

1

This seems like a general use case. Just the fact that you're using audio files instead of video, images or pdfs etc.

When you add (INSERT) a track to the DB:

  1. Use an upload form - upload to a certain directory
  2. Store the path in the DB, along with any other info

When you retrieve (SELECT), grab the path from the DB and place into a player or audio tag.

http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_audio_all

However, if you use a HTML5 tag, then you have to supply all the playable files or just MP3 - I think all browsers will play MP3.

0

Yh, I will contribute to diafol's contribution. One thing you must keep in mind that storing music tracks directly in the database is a bad practice. This can slow down you server and make the SQL datables unnecessary large in terms of file size.

0

Perhaps it's obvious, be very careful about uploading mp3s, for which you may not have a licence, and allowing visitors to play them!
If you're doing this sort of thing, then it may be illegal. However, you can use 3rd party APIs to do this for you, like Spotify and EchoNest, which allow you to create playlists in your own pages.

EchoNest has some particularly nice search features. I dabbled a bit about a year ago, so it's probably changed a bit by now.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.