SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Location
    BD
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can i make Database BASE Audio site???

    I have a website and i want to add music section there so that i can do that manually but i want to do that with PHP and MySQL so my plan is : In my database i have 4 things those are ARTIST , ALBUM , SONGS NAME & DOWNLOAD LINKS. so on my Audio Index page i want to echo ONLY ARTIST NAME then if someone click on ARTIST name he will go another page and can see All Albums of That ARTIST and WHEN he click on Album Name he will see Songs name And Download Link . Please help me or give me any script location because i am not good in PHP and MySQL. Please give me MySQL structure and PHP script . Thank You in Advance.

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    How much are you going to pay us to do all of this work for you? I hope you understand, WE ARE NOT A SOURCE OF FREE LABOR.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Location
    BD
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i didnt say like that bro but i wanted to know the concept and if u know abt that then pls give me idea or if u know any source u can just suggest me

  4. #4
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  5. #5
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Location
    BD
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you bro but its long term process and i am learning already but i am not fully professional ... anyways thank you but i wanted to do that early so i posted but ur suggestions are helpfull waiting for others if they will help me... God Bless you

  6. #6
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    2 Thread(s)
    Hi anturj,

    You would probably be better to do this more like a search page with the potential filters being Artist, Album, Song. Instead of having a user traverse 3 pages, you could set this up in one page as a form. Then use a traditional post on submit to carry the selected filters over to a PHP page that grabs the post values, connects to the database, runs an SQL query and then returns the result set back that is "ORDER BY" in a hierarchy based on the filters that are chosen. This is typically done where you've grab the $_POST values and then dynamically build the SQL query. Normally this is done like
    PHP Code:

    $sql 
    "
    SELECT 
      artist
      , album
      , song
    FROM
      music
    WHERE 
      1 = 1 "

    Now the 1=1 might be a little puzzling. This is done so you can append 'AND' statements after the 1=1 and no matter if any or one or more filters are chosen then the query will still run.

    To test if filters exists, you would then do this:
    PHP Code:

    if ($_POST['artist']) {
    $artist mysql_escape_string($_POST['artist']);
    $sql .= "
      AND
        artist = 
    $artist 
    "
    ;
    }
    if (
    $_POST['album']) {
    $album mysql_escape_string($_POST['album']);
    $sql .= "
      AND
        album = 
    $album
    "
    ;
    }
    if (
    $_POST['song']) {
    $song mysql_escape_string($_POST['song']);
    $sql .= "
      AND
        song = 
    $song
    "
    ;

    The use of mysql_escape_string() is not encouraged as it is now recommended to use PDO or mysqli to prepare and bind values, however I have used this just to show that you need in some way to clean all input data including $_POST, $_GET, $_SESSION, even JSON and serialized data.

    If your form filter fields use free-text rather than combo box selections then you can substitute the equal sign (=) for LIKE: i.e.
    PHP Code:
    if ($song) {
    $sql .= "
      AND
        song LIKE %
    $song%;
    "
    ;

    This will allow people to kind of know who the song name but don't have the exact title so in this case it will match songs like whatever name they type in the song form field.

    One other thing is that you may consider using a javascript library like jQuery to perform an AJAX $_POST. This has the advantage of simplifying implementing AJAX and you can POST and return a result set by using a callback that will for instance return the results in JSON format without reloading the page.

    But see how you make out with the first idea and I hope this helps a little.

    Regards,
    Steve
    Last edited by ServerStorm; Sep 28, 2012 at 22:00.
    ictus==""

  7. #7
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Location
    BD
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its well bro and this will help for make search engine for songs but actually i wanted to know : let me discuss : Suppose i have i music index page and on that page only show all artists name. and those artists name look like a button. if someone click on any artist name he will go another page and can see that artists all albums, and all albums also look like a link so if users choose or click on any album and click then he will go another page and he will able to see all songs under the albums . i wanted to know abt this. Do u have any idea bro ? @ ServerStorm help me please .

    Thanks in Advance dear


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •