LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Help With PHP Code (https://www.linuxquestions.org/questions/programming-9/help-with-php-code-361495/)

windisch 09-08-2005 02:15 PM

Help With PHP Code
 
I have modified some code so I can use php to do a mysql search of my music catalog. It displays it in a nice format on a second page. I would like to make part or all of the info clickable so I can request the song to be played through shoutcast.

This is probably a stupid question, but I just can't figure out how to create a hyperlink out of this data. Here is the actual code that displays.

PHP Code:

$i=0;
while (
$i $num) {

$artist=mysql_result($result,$i,"artist");
$album=mysql_result($result,$i,"album");
$title=mysql_result($result,$i,"title");
$genre=mysql_result($result,$i,"genre");
$year=mysql_result($result,$i,"year");
$length=mysql_result($result,$i,"length");
$length2=$length/60000;
$intid=mysql_result($result,$i,"intid");
#$web=mysql_result($result,$i,"web");

echo "<b>Artist: <P2>$artist</P2> Title: <P2>$title</P2><br>Album: <P2>$album</P2></b> Year: <P2>$year</P2><br>Song # <P2>$intid</P2> Genre: <P2>$genre</P2><br> Length: <P2>$length ms or $length2 minutes.</P2><br><hr>";

$i++; 

Thanks,
Adam Windisch

david_ross 09-08-2005 02:20 PM

I'm not sure what you are looking for other than changing:
echo "<b>Artist: <P2>$artist</P2> Title: <P2>$title</P2><br>Album: <P2>$album</P2></b> Year: <P2>$year</P2><br>Song # <P2>$intid</P2> Genre: <P2>$genre</P2><br> Length: <P2>$length ms or $length2 minutes.</P2><br><hr>";

To:
echo "<b>Artist: <P2>$artist</P2> Title: <P2><a href='http://url.you.want/to/link/to'>$title</a></P2><br>Album: <P2>$album</P2></b> Year: <P2>$year</P2><br>Song # <P2>$intid</P2> Genre: <P2>$genre</P2><br> Length: <P2>$length ms or $length2 minutes.</P2><br><hr>";

windisch 09-08-2005 02:35 PM

Ok, I tried that before, but that worked. I must have missed a quote or something. Thanks for your help!

mcleodnine 09-08-2005 05:43 PM

Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.

windisch 09-09-2005 07:37 AM

Sorry about that, if I have more PHP questions, I'll put it in programming.


All times are GMT -5. The time now is 05:40 PM.