Do you know how to use the "SELECT" query in SQL?
you need to pull that result into a variable. eg.
$query="SELECT id, name FROM mytable";
$result=mysql_query($query);
//Put the results into an array:
$row=mysql_fetch_array($result)
//Then you can print the results of that array:
echo $row['id'].' '.$row['name'];
//If the ID is '1' and the name is John, this will display: "1 John".
//To make the ID a link, you can just wrap it in html code thusly:
<a href="name.php"><?php echo $row['id'];?></a>
//The problem here is that all you've done there is to make the displayed text '1'
//a link to a page with nothing on it, you haven't passed the ID onto the next
//page. So you amend the code above - this is php embedded in html code:
<a href="name.php?id=<?php echo $row['id']?>">The ID is <?php echo $row['id'];?> but what is the name?</a>
//now you need to create your "name.php" page
//Check - am I receiving an ID?
//The ! denotes 'NOT', so in English says "If $_GET['id'] variable is NOT there, or
//if I cannot find the 'id' variable
<?php if ((!isset($_GET['id']))
//the '||' means OR
||
//'trim' means 'take out spaces', so what this line says is "if I take out spaces and there is nothing left (so you're left with '')
trim ($_GET['id'] ==''))
//In short the line looks like below and means "If I don't receive an 'id' variable,
//or if I do receive one and there is nothing in it, do this:"
if ((!isset($_GET['id'])) || trim ($_GET['id'] ==''))
{
die ('Missing record ID');
}
//this is where the 'if' statement ends, saying if there is no ID, stop the process
//and state that there is 'no record ID'
//If those statements AREN'T true (ie. that a variable called 'id' IS there and it
//IS NOT blank) then you can proceed as you started, with displaying the results:
//you need this because while you've checked it's there, you haven't formally requested it yet
$id=$_GET['id'];
//now proceed as before, note that in the SQL you're now specifying
//information from that ID using the WHERE clause
$query= "SELECT id, name FROM mytable WHERE id='$id'";
$result=mysql_query($query);
//Now you can print the result
echo 'The id you gave me is  '.$row['id'];
echo 'The name of this person is: .$row['name'];
?>
//This should print out, in the above scenario
The id you gave me is 1
The name of this person is John
Hope this makes sense. Be warned though - there may be typos and errors, I'm only a newb myself.