Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP Mysql and Hyperlinks

Posted on 2002-03-27
1
Medium Priority
?
265 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
[X]
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
1 Comment
 
LVL 5

Accepted Solution

by:
andriv earned 200 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

704 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