I am total newb here, so bare with me.

In the code below I would like to make the output of the 'url' an actual link.
<td><?php echo $row_thisone; ?></td>
Can someone please tell me the proper syntax.
I have tried many things with no luck.
Thanks in advance!

Here is the whole thing:


<table border="1">
<tr>
<td>site_name</td>
<td>link_text</td>
<td>url</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_thisone; ?></td>
<td><?php echo $row_thisone; ?></td>
<td><?php echo $row_thisone; ?></td>
</tr>
<?php } while ($row_thisone = mysql_fetch_assoc($thisone)); ?>
</table>

</body>
</html>
<?php
mysql_free_result($thisone);

mysql_free_result($hi);
?>

what exactly are you storing in the database, url wise? more information about this would be helpful.

what exactly are you storing in the database, url wise? more information about this would be helpful.

The table in the database has a field called url
In the url field is an actual url.
example: http://www.yourdomain.com

and you want this to be a html link "<a href="">...."

and you want this to be a html link "<a href="">...."

Yes that is correct

<?php
$table = '<table border="1"><tr><td>site_name</td><td>link_text</td><td>url</td></tr>';
while ($row_thisone = mysql_fetch_assoc($thisone)) {
$table .= '<tr><td>' . $row_thisone['site_name'] . '</td><td>' . $row_thisone['link_text'] . '</td><td><a href="' . $row_thisone['url'] . '">LINK</a></td></tr>';
}
$table .= '</table>';
echo $table;

?>

;

First off thank you!

Ok this works pretty cool.

Now how can I replace the word LINK with the actual url?
<a href="' . $row_thisone . '">LINK</a></td></tr>'

Thanks

<?php
$table = '<table border="1"><tr><td>site_name</td><td>link_text</td><td>url</td></tr>';
while ($row_thisone = mysql_fetch_assoc($thisone)) {
$table .= '<tr><td>' . $row_thisone['site_name'] . '</td><td>' . $row_thisone['link_text'] . '</td><td><a href="' . $row_thisone['url'] . '">LINK</a></td></tr>';
}
$table .= '</table>';
echo $table;

?>

;

use this:

<?php
$table = '<table border="1"><tr><td>site_name</td><td>link_text</td><td>url</td></tr>';
while ($row_thisone = mysql_fetch_assoc($thisone)) {
$table .= '<tr><td>' . $row_thisone['site_name'] . '</td><td>' . $row_thisone['link_text'] . '</td><td><a href="' . $row_thisone['url'] . '">' . $row_thisone['url'] . '</a></td></tr>';
}
$table .= '</table>';
echo $table;

?>

Perfect! Thanks so much!

And now looking at your code, it is starting to make more and more sense to me.

Thanks again!

Lego

use this:

<?php
$table = '<table border="1"><tr><td>site_name</td><td>link_text</td><td>url</td></tr>';
while ($row_thisone = mysql_fetch_assoc($thisone)) {
$table .= '<tr><td>' . $row_thisone['site_name'] . '</td><td>' . $row_thisone['link_text'] . '</td><td><a href="' . $row_thisone['url'] . '">' . $row_thisone['url'] . '</a></td></tr>';
}
$table .= '</table>';
echo $table;

?>

I see how the links will work, but where are you pulling the information from the database.

You're going to need an SQL command to pull the information so that it goes into your link.

It could be something simple like:

<?php
$sql = "SELECT 'site_name, link_text, url' FROM ' . LINKS_TABLE . '";
$thisone = mysql_query($sql);
?>

i excluded the sql and the query because he already has it. he just need to display the results properly