Add hyperlinks to db-derived text


I’ve gotten a lot of good tips from kirupa so here goes:

I am working on an mp3 player that pulls song titles from a database, using php and MXPRO2004.

I am able to display the song titles in a scrolling pane that contains a duplicating text box.

I would like to learn how to make a link for each song that would load an mp3 into Flash and play it, depending on the song title that is clicked.

The songs would be named 1.mp3, 2.mp3 etc, and would be kept in a specific folder. This folder would be based upon the album’s catalog number ( /audio/mp3/catalog_id/1.mp3 ). The catalog_id would be loaded from the page url and inserted into the link. The catalog_id would be a number, like 6528.

The mp3 file names (1.mp3 etc) would then append themselves to the link for the corresponding title.

Can someone point out a thread that talks about this or give me a few hints? Thanks alot!

The code that I have so far, which loads the titles::

myLoad = new LoadVars();
myLoad.path = this;
//this is the group’s name::
myLoad.musical_group_id = _root.musical_group_id;
//this is the album name::
myLoad.catalog_id = _root.catalog_id;

myLoad.onLoad = function(success)
if (success) {
this.path.pane_sp.boundingBox_mc._visible = false;
var mc = this.path.pane_sp.getScrollContent();
for (var i = 0; i < Number(this.totals); i++) {
var item = new Object();
item.title = this[“title” + i];
item._y = i * 25;
mc.attachMovie(“singleRecord”, “record” + i, i, item);
} else {
myLoad.SendAndLoad(“flash_songs.php”, myLoad, “GET”);

I have done something of this sort…

instead of loading it into a textbox… make some sort of XML file or txt file that stores the names and mp3s as file and display them in a list… it makes it a lot easier and a lot more aesthetic. As for the links doing something through a textbox, I can’t really think of anything that would do that…



I like your player, Cool beatz!

In the past I have made an swf that is loaded by a text file, but never from XML. I remember that my text file allowed me to make the links easily, but not dynamically (from database).

Hmm, it looks like I used (statically placed) buttons over each song title with a script to load the numbered songs depending on button name.

I need this new player to be able to adapt to any variables (any number of songs) without having to make a new text/xml/ file every time or change number of buttons/text boxes in the swf.

I think I can do it! It looks like I need to combine the function of the two players somehow, making the buttons duplicate the way that I have my text boxes duplicating, and loading the songs from db instead of a static file.

>>>Do you know where I could learn how to make my PHP script create an XML file? Maybe XML will solve all my problems <^;

Thanks for replying and Happy New Year!

This is what I have now, where flash loads the song titles:

$hostname = “hostname”;
$username = “username”;
$password = “password”;
$dbName = “dbName”;

MSSQL_CONNECT($hostname,$username,$password) or DIE(“DATABASE FAILED TO RESPOND.”);
mssql_select_db($dbName) or DIE(“Table unavailable”);
$song_query=“SELECT title, parent_object_id, catalog_id FROM SongList_view WHERE catalog_id=” . $_GET[catalog_id] . ’ and parent_object_id =’ . $_GET[musical_group_id];

$result = mssql_query($song_query);

$num_rows = mssql_num_rows($result);

$row = mssql_fetch_array($result);

 $title = "title$i";
 $title = $row['title'];