Solved

Place a Link in PHP Code

Posted on 2011-03-04
2
316 Views
Last Modified: 2013-12-25
Is there a way for me to place a link named "Edit" on the line where is have   ***I NEED TO PLACE A LINK HERE TO GO TO FILE edit.php*** in the attached code?

I just need the word "Edit" to be shown in the table so I can click on it to take me to the edit.php file.
<?php
$con = mysql_connect("localhost","uname","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("mydatabase", $con);

$result = mysql_query("SELECT * FROM mytagble");

echo "<table border='7'>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Status</th>
<th>Edit</th>
<th></th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['fname'] . "</td>";
  echo "<td>" . $row['lname'] . "</td>";
  echo "<td>" . $row['status'] . "</td>";
  ***I NEED TO PLACE A LINK HERE TO GO TO FILE edit.php***
  echo "</tr>";
  }
echo "</table>";

?>

Open in new window

0
Comment
Question by:wantabe2
2 Comments
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
ID: 35037005
you mean:
 echo "<td><a href=\"edit.php?item_key=" . $row["key"] . "\">edit</a></td>";

Open in new window

0
 
LVL 4

Accepted Solution

by:
Tomun earned 250 total points
ID: 35037007
replace your line with

echo '<td><a href="edit.php">edit</a></td>';
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

758 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

21 Experts available now in Live!

Get 1:1 Help Now