tags:

views:

37

answers:

3

Hello,

I am trying to turn something I requested from a MySQL table into a 'link', which is also saved in the table. Therefore, in the code below, I am trying to turn 'fldFullName' into the 'ProfileURL', both which are in the same table. After that, I should be able to click on the Full Name, say maybe John Smith, and it should take me to the link provided in the MySQL table, say http://www.domain.com/page.php?id=001313 maybe. How can I do this properly?

             {  
             echo '<span id="guest">' . $row['fldFullName'] . '<a href="' . $row['ProfileURL'] .'">'. $row['ProfileURL'] . '</a></span><br />';
             }  

Thank you in advance.

A: 

If i'm understanding you correctly then you were very close.

This gives you the Fullname as a link which then links to the address provided by the profileURL field:

 echo '<a href="' . $row['ProfileURL'] .'">' . $row['fldFullName'] . '</a>';
elduderino
That will only print the text of the full name but no link at all. And there are even many errors in you code. Remove the quotation marks and dot before and after the var from the array. But even than it's only the text and no link.
Kau-Boy
Sorry new ot this site...forgot to wrap my code in code tags :(
elduderino
Better but even not perfect. You are still missing a quotation marks after the closing bracket of the opening tag of the link. and you have removed the span with the id which might be needed. Just copy the rest of my answer and you are right ;)
Kau-Boy
+1  A: 

Your problem is, that the full name is not within the Tag. So correct you code to something like this:

echo '<span id="guest"><a href="'.$row['ProfileURL'].'">'.$row['fldFullName'].'</a></span><br />';

If you still want the ProfileURL visible, you can also include it within the tag.

Kau-Boy
+2  A: 
echo "<span id='guest'><a href='{$row['ProfileURL']}'>{$row['fldFullName']}</a></span><br />";
no