LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-08-2005, 02:15 PM   #1
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Rep: Reputation: 30
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
 
Old 09-08-2005, 02:20 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
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>";
 
Old 09-08-2005, 02:35 PM   #3
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Original Poster
Rep: Reputation: 30
Ok, I tried that before, but that worked. I must have missed a quote or something. Thanks for your help!
 
Old 09-08-2005, 05:43 PM   #4
mcleodnine
Senior Member
 
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731

Rep: Reputation: 45
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 09-09-2005, 07:37 AM   #5
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Original Poster
Rep: Reputation: 30
Sorry about that, if I have more PHP questions, I'll put it in programming.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple PHP code aznita Programming 1 06-19-2005 11:50 PM
PHP not parsing code... libertyboy Linux - Software 3 08-24-2004 11:09 AM
php code lynger Linux - Software 0 01-07-2004 02:21 AM
PHP MySQL code pnh73 Programming 13 09-29-2003 01:56 PM
I need help with this PHP code. I'm stumped lostboy Programming 1 08-22-2003 05:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration