3
Contributors
10
Replies
17
Views
8 Years
Discussion Span
Last Post by somedude3488
0

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

0

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

Yes that is correct

0
<?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;

?>

;

0

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;

?>

;

0

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;

?>
0

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;

?>
0

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);
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.