Results 1 to 9 of 9

Thread: songs linking problem

  1. #1
    Join Date
    Sep 2007
    Posts
    172
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default songs linking problem

    I have a problem and it is I have a table of songs without any link I have to link that song with a php name a prime example is http://apniisp.com/songs.php?id=656 like this can someone help me that how to do it?

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    You can use MySQL to store the location of the file, and give it an ID.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  3. #3
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    133
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    to get the number that is set in that link

    Code:
    $number = $_GET['id'];
    to find the song

    Code:
    $song = mysql_fetch_array(mysql_query("select * from songs where ID = $number"));
    and finally to play the song

    Code:
    <EMBED 
       SRC=<?php echo "$song['link']" ?>
       HEIGHT=0 WIDTH=0>
    this is assuming you have a table called songs with 2 different rows called ID and link
    Last edited by Demonicman; 10-20-2007 at 03:56 PM.

  4. #4
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    PHP Code:
    $number $_GET('id'); 
    should be
    PHP Code:
    $number $_GET['id']; 
    'cause you're not calling the $_GET() function. You are getting a value of the $_GET array.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  5. #5
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    133
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    i knew that :P thanks though

  6. #6
    Join Date
    Sep 2007
    Posts
    172
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    I dont want people to embed the song I want them to download it with a php id, aren't it possible with a simple php code? I have to make tables in mysql?

  7. #7
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Anything from the internet can be stolen.

    Anyway, you can create a table, then retrieve it using SELECT with MySQL.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  8. #8
    Join Date
    Sep 2007
    Posts
    172
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    No worries if the songs will going to be stolen I don't know using MYSQL, wouldn't it possible by any JAVASCRIPT OR PHP?

  9. #9
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Well, you could manually add all the URLs of the video files into an array, then retrieve 'em with ?id=123

    Example:

    PHP Code:
    $myvideos = array('link1.avi','link2.avi');
    $id $_GET['id'];

    echo 
    '<embed src="'.$myvideos[$id].'"></embed>'
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

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
  •