0

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.

3 Answers 3

2
echo "<span id='guest'><a href='{$row['ProfileURL']}'>{$row['fldFullName']}</a></span><br />";
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

0

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>';

3 Comments

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.
Sorry new ot this site...forgot to wrap my code in code tags :(
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 ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.