PHP:page.php?id= ????

Hi, i have this script to read from mysql (layout below) and the script will display the course title, and a url to the id, but when i click on the url it just goes back to that page(displaying all the course titles)but when u click on a course title i want it to read from detail table in php and display all the data in detail. how would i modifie the script to do that??

<html>

<body>

<?php

$db = mysql_connect("localhost", "root");

mysql_select_db("compulearn",$db);

// display individual record

if ($id) {

$result = mysql_query("SELECT * FROM courses WHERE id=$id",$db);

$myrow = mysql_fetch_array($result);

printf("First name: %s\n<br>", $myrow["courses"]);

} else {

// show employee list

$result = mysql_query("SELECT * FROM courses",$db);

if \($myrow = mysql\_fetch_array\($result\)\) \{

  // display list if there are records to display

  do \{

    printf\("&lt;a href=\\"%s?id=%s\\"&gt;%s %s&lt;/a&gt;&lt;br&gt;\\n", $PHP_SELF, $myrow["id"], $myrow["courses"], $myrow[""]\);

  \} while \($myrow = mysql\_fetch_array\($result\)\);

\} else \{

  
  echo "Sorry, no records were found!";	

\}

}

MYSQL TABLE

+------+-------------------+-------------------+
| ID | Courses | detail |
+------+--------------------+------------------+
| intro | Intoductions | This course....|
+------+--------------------+------------------+

Please someone tell me.i hope u understand what iam lookin for,.

I'm not sure if this wil solve the problem, but kill the quotes in the array indecies and put them directly into a print() call, like so:

print("<a href=\"$PHP_SELF?id=$myrow[id]$myrow[courses]$myrow[]");

then change the if($id) to if(!isset($id))... come to think of it, that's probably what's wrong. If you were getting a valid URL with fprint(), then disregard the first thing i said...