Log in

View Full Version : songs linking problem



bbilal
10-19-2007, 08:34 PM
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?

tech_support
10-20-2007, 04:22 AM
You can use MySQL to store the location of the file, and give it an ID.

Demonicman
10-20-2007, 06:44 AM
to get the number that is set in that link


$number = $_GET['id'];

to find the song


$song = mysql_fetch_array(mysql_query("select * from songs where ID = $number"));

and finally to play the song


<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

tech_support
10-20-2007, 07:24 AM
$number = $_GET('id');
should be

$number = $_GET['id'];

'cause you're not calling the $_GET() function. You are getting a value of the $_GET array.

Demonicman
10-20-2007, 03:57 PM
i knew that :P thanks though

bbilal
10-21-2007, 02:22 PM
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?

tech_support
10-22-2007, 10:44 AM
Anything from the internet can be stolen.

Anyway, you can create a table, then retrieve it using SELECT with MySQL.

bbilal
10-22-2007, 11:06 AM
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?

tech_support
10-22-2007, 11:15 AM
Well, you could manually add all the URLs of the video files into an array, then retrieve 'em with ?id=123

Example:



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

echo '<embed src="'.$myvideos[$id].'"></embed>';