SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Jun 1, 2009, 00:34 #1
- Join Date
- May 2009
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Insert link from mysql database into html
In my mysql database, I have web addresses which I want to bring into an html page.
<a href="url from mysql database">Link text</a>
How do I do this?
-
Jun 1, 2009, 00:39 #2
- Join Date
- Aug 2000
- Location
- Philadephia, PA
- Posts
- 20,578
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
PHP Code:<?php
mysql_connect('hostname', 'username', 'password');
mysql_select_db('databasename');
$query = "SELECT url FROM table";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo '<a href="' . $row['url'] . '">Link Text</a> ';
}
?>Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more
-
Jun 1, 2009, 00:42 #3
- Join Date
- May 2009
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks a lot.
Bookmarks