Question Add a link to Database field

joe904

Distinguished
Apr 11, 2015
34
0
18,530
Hey guys,

I am creating a Knowledge Base website. I have a database that stores my information. One of the fields is a URL. I want the URL to show as an actual link in the browser and not a website address. This is the code that I am using. I am not sure how to add "a href" to my code and have it not error out.

echo "<td style='white-space:nowrap; text-align: center;'>".$row['Issue']."</td>";

while($row = $result->fetch_array()){
echo "<tr>";
echo "<td style='text-align: center;'>".$row['Hardware / Software']. "</td> ";
echo "<td style='text-align: center;'>".$row['Platform']."</td>";
echo "<td style='text-align: center;'>".$row['Application']."</td>";
echo "<td style='white-space:nowrap; text-align: center;'>".$row['Issue']."</td>";
echo "<td style='text-align: center;'>".$row['Solution']."</td>";
echo "<td style='text-align: center;'>".$row['Date']."</td>";

Any help is much appreciative.
 
Database - MySQL
Field - varchar
The error is a syntax error from the editor. I have tried various ways to add the a href tag but have had no luck.
 
Syntax error, Unexpected T_String, expecting ' , ' or ' ; '
HTML:
echo "<a href="www.google.com"><td style='white-space:nowrap; text-align: center;'>".$row['Issue']."</td></a>";

Syntax error, unexpected '<'

HTML:
<a href="www.google.com">echo "<td style='white-space:nowrap; text-align: center;'>".$row['Issue']."</td></a>";
 
Not sure [full disclosure] about a specific solution per se but I see some things that make me wonder and ask questions.

The difference between the two examples being the removal of edit and the double quote preceding <a - correct?

Should there be another double quote removed? What would be or could be that unexpected '<'?

= = = =

Table being 6 fields wide:

Hardware/Software
Platform
Application
Issue
Solution
Date

Syntax error(s) only appearing for 'Issue' - correct?

'Issue' being the URL and Datatype VARCHAR

What are the actual characters being stored in the 'Issue' field? Datatype = VARCHAR?

Also wondering about the "While" in Post #1 - should there be a </tr> somewhere?