General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 19th, 2003, 06:27 PM
das das is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 5 das User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to das
Making dynamic text into links

i'm trying to make some text returned into a link. the last cell in the table will contain a URL. i want to make the text a link, using the variable URL as the desination address. any thoughts?

thanks.

PHP Code:
<?php
$db
="illuminationrecords";
$connect mysql_connect("","","");
if (! 
$connect)
die (
"Couldn't connect to MySQL");
mysql_select_db($db$connect) or die ("Select DB Error: ".mysql_error());
$query "SELECT Party, PartyDay, ProdCo, Address, City, State, Phone, PartyTime, Age, Price, URL FROM illumparty";
$result mysql_query($query,$connect);
echo 
"<table border=0>\n";
  while (
$myrow mysql_fetch_row($result)) {
      
printf("<tr class='info'> 
    <td class='party'>%s</td>
    <td>%s</td>
    <td class='clubinfo'>%s</td>
    <td class='clubinfo'>%s</td>
    <td class='clubinfo'>%s</td>
    <td class='clubinfo'>%s</td>
    <td class='clubinfo'>%s</td>
    <td class='clubinfo'>%s</td>
    <td class='clubinfo'>%s</td>
    <td class='clubinfo'>%s</td>
    <td>%s</td> - I want to make this a link, using the variable URL as the destination
  </tr>\n"
,
      
$myrow[0],$myrow[1],$myrow[2],$myrow[3],$myrow[4],
    
$myrow[5],$myrow[6],$myrow[7],$myrow[8],$myrow[9],
    
$myrow[10]);
    }

echo 
"</table>\n";

Reply With Quote
  #2  
Old June 19th, 2003, 07:35 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
Take a look at this snippet of code:

PHP Code:
<?php

$url 
"http://www.microsoft.com/";

?>

<a href="<?php print $url;?>">visit</a>


That should give you the answer to your question.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old June 21st, 2003, 10:57 PM
das das is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 5 das User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to das
let me rephrase this:

i am pulling content from a database. one of the fields being returned is a url. i want to make that url a link to the url that it represents.

does that change the example above?

Reply With Quote
  #4  
Old June 22nd, 2003, 01:15 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 6
well then

PHP Code:
<?php

$url 
$row['url'];

?>

<a href="<?php print $url;?>">visit</a>
__________________
-- Jason

Reply With Quote
  #5  
Old June 22nd, 2003, 02:17 PM
Kanu Kanu is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 91 Kanu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
No, he's trying to do something along the lines of pull both a name for the link and the link itself from the database, then display them.

The code is almost right. You'd create an array with the values in it and then have code liek:

PHP Code:
<a href="<?php echo $row[url]; ?>"><?php echo $row[name]; ?></a> 


Or something like that.

Reply With Quote
  #6  
Old June 22nd, 2003, 06:16 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
You may be correct, however that is 100% assumption. I've read over his post and can't find any evidence that he wants the link text to actaully be pulled from the database:

Here is his text:
Quote:
i'm trying to make some text returned into a link. the last cell in the table will contain a URL. i want to make the text a link, using the variable URL as the desination address. any thoughts?

He states, "I'm trying to make some text returned into a link"
He specified "SOME" text... not "Text from the database".

He also stated "the last cell in the table will contain a URL", which leads me to believe that if he really wanted the text to come from the database he would have also stated this... Why would he be explicit about the URL part, but say nothing of the url TEXT?

However, you still are most likely correct... I just wanted to point out that he really made it tough to help him since he didn't outline his needs very well. Such a simple request could have been tackled in one post; instead we've posted at least 7 times.

Reply With Quote
  #7  
Old June 22nd, 2003, 07:32 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 6
agreed

Reply With Quote
  #8  
Old June 25th, 2003, 08:22 PM
das das is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 5 das User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to das
sorry guys. should've been clearer.

i figured it out with your help. it was actually a combination of taelo's and kanu's examples.

thanks again.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Making dynamic text into links


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway