Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

PHP Mysql and Hyperlinks

Posted on 2002-03-27
1
261 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
ID: 6900528
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

856 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