View Single Post
Old 12-12-2012, 03:22 PM   PM User | #1
mharrison
New Coder

 
Join Date: Dec 2012
Posts: 52
Thanks: 12
Thanked 0 Times in 0 Posts
mharrison is an unknown quantity at this point
Results in a link question

Hello...I'm new to programming with PHP, but as I'm going through tutorials and reading books I've come across a question I have not been able to figure out.

I have a table with 2 fields....one field is just text and the other is for a URL.

I want to have a link created that uses the url for the link and the text field for the text.

Here is the code I have so far, but I cannot get it to work:

Code:
<html>
<head>
<title>Test Page</title>
</head>
<body>
<?php
mysql_connect('hostname','username','password');
mysql_select_db('db_name') or die (mysql_error());
$result = mysql_query("SELECT * from patterns");
$row = mysql_fetch_array($result);
echo <a href="$row[lnktxt]">$row[dsptxt]</a>;
}
?>

</body>
</html>
Any help would be appreciated
mharrison is offline   Reply With Quote