Related frames
| From: | John Halladay | Date: | Thu, 15 Feb 2001 22:46:47 +0000 |
| Subject: | Related frames | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6669@lists.php.net to get a copy of this message | ||
I'm trying to have a link in one frame display data in the main frame. Here
is an example of what I have set up. Normally in HTML you would have
TARGET="main" in the <a href=""> </a> spot, but I tried that and it
gives me
a parse error. Any ideas on how to do it, or does anyone have know of any
websites that I could check.
Thanks,
John Halladay
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
// display individual record
if (isset($id)) {
$result = mysql_query("SELECT * FROM employees WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
printf("First name: %s\n<br>", $myrow["first"]);
printf("Last name: %s\n<br>", $myrow["last"]);
printf("Address: %s\n<br>", $myrow["address"]);
printf("Position: %s\n<br>", $myrow["position"]);
} else {
// show employee list
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("<a href=\"%s?id=%s\">%s %s</a><br>\n", $PHP_SELF,
$myrow["id"],
$myrow["first"], $myrow["last"]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
?>
</body>
</html>