Solved

PHP Mysql and Hyperlinks

Posted on 2002-03-27
1
262 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ajax and PHP 4 47
Date comparison to same 'wednesday' of previous year 3 28
Multi line FPDF footer: 3 23
MySQL Persistent Connections 10 31
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 look for a specific file type in a local or remote server directory using PHP.

740 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