Solved

PHP Mysql and Hyperlinks

Posted on 2002-03-27
1
259 Views
Last Modified: 2012-05-04
This php block will enable me to retrieve data from a mysql database.  How can I create a link on results of the block?. My intention is to enable users to link right after a successful database search. ie link from co_name (result) to company website.
---------
$sql = "
select co_name, industry, other, your_name, email, address, country, city, telephone, biz_desc
from $table_name
order by cust_num desc
";
$result = @mysql_query($sql,$connection)or die("could not execute query");
while ($row = mysql_fetch_array($result))
{
$co_name        = $row['co_name'];
$industry       = $row['industry'];
$other                 = $row['other'];
$your_name      = $row['your_name'];
$email          = $row['email'];
$address        = $row['addres'];
$country        = $row['country'];
$city           = $row['city'];
$telephone      = $row['telephone'];
$biz_desc       = $row['biz_desc'];
$display_block .= "
<strong>$co_name</strong><br>
($co_name) | ($industry) | ($other) | ($your_name) | ($email) | ($address)<br>
($country) | ($city) | ($telephone)<br>
<em>($biz_desc)</em>
";
}
?>
<? echo "$display_block"; ?>
</body>
</html>
0
Comment
Question by:Senyonjo
1 Comment
 
LVL 5

Accepted Solution

by:
andriv earned 50 total points
Comment Utility
Add the anchor tag around $co_name but where are you getting the URL from. In the example below I used a variable for the URL but you are going to have to get the value from somewhere, most likely the db

$display_block .= "
<strong><a href=\"$url\">$co_name</a></strong><br>
($co_name) | ($industry) | ($other) | ($your_name) | ($email) | ($address)<br>
($country) | ($city) | ($telephone)<br>
<em>($biz_desc)
";
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now