i'm sorry my title is confusing

here's my problem

i've created this

echo "<table border='1'>
<tr>
<th>Idno</th>
<th>Name</th>
<th>Specialty</th>
<th>Email</th>
<th></th>
</tr>";
    while($row = mysql_fetch_array($result))
    {
  echo "<tr>";
  echo "<td>" . $row['Idno'] .  "</td>";
  echo "<td>" . $row['LastName'] . " " . $row['FirstName'] . " " . $row['MiddleName'] . "</td>";
  echo "<td>" . $row['Specialty'] . "</td>";
  echo "<td>" . $row['Email'] . "</td>";
  echo "<td>" . 'Please <a href="/view.php">try again</a>.' . "</td>";
  echo "</tr>";
   }

my problem is how could i view the profile of that specific person from a specific row into a form or a new table...

here's a pic of the table
http://i55.tinypic.com/1z5qano.jpg

btw,i'm still a noobie about php so please bear with me T__T i really need a help

You have this

echo "<td>" . 'Please <a href="/view.php">try again</a>.' . "</td>";

Try this

echo "<td>Please <a href=\"view.php?id=".$row['id']."\">try again</a></td>";

What this will do is when the user clicks on the link, the link will contain the id to the row in the database. Then when it goes to try.php, just use the $_GET in your mysql statement to display the row.

^ yout try.php are you referring to the view.php in the code

so i'm gonna make another php that contains get $_GET

like this


<html>
<?php
$db = mysql_connect("localhost","root","");
mysql_select_db("Hospital",$db);
$d_idno = $_GET;
$d_lastname = $_GET;
$d_firstname = $_GET;

how about the sql= what will i use INSERT,UPDATE or what?

do i have to make a table or form? how should i do it.. i'm really sorry

What exactly do you need to do? It seems like you might be trying to edit the profile information? In which case, you need to do two things:

1) Use mysql_real_escape_string() on the $_GET variables.

$d_idno = mysql_real_escape_string($_GET['d_idno']);
$d_lastname = mysql_real_escape_string($_GET['d_lastname']);
$d_firstname = mysql_real_escape_string($_GET['d_firstname']);

Then, use UPDATE on the table:

$query ="UPDATE Table_name SET 
Idno=$d_idno, 
Name='$d_firstname $d_lastname' 
WHERE Idno = $d_idno LIMIT 1";
mysql_query($query) or die(mysql_error());