problem of passing unique Key to detail page

Links for php scripts

Moderators: macek, egami, gesf

begeiste
New php-forum User
New php-forum User
Posts: 83
Joined: Thu Jun 03, 2004 11:27 am

problem of passing unique Key to detail page

Postby begeiste » Thu Aug 26, 2004 9:10 am

I have created the photo displaying page,but I have a problem for passing the unique Key which is ID to the detail page, when I click on the thumbnail to open a detail page, but the problem is that cann't pass the right ID to the detail page. Any input will be appreciated.
Here is the link:http://www.symphonyimage.com/billboard.php

Here is code:
<?php require_once('Connections/victorphoto.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_rec_bill = 10;
$pageNum_rec_bill = 0;
if (isset($_GET['pageNum_rec_bill'])) {
$pageNum_rec_bill = $_GET['pageNum_rec_bill'];
}
$startRow_rec_bill = $pageNum_rec_bill * $maxRows_rec_bill;

mysql_select_db($database_victorphoto, $victorphoto);
$query_rec_bill = "SELECT * FROM billboard";
$query_limit_rec_bill = sprintf("%s LIMIT %d, %d", $query_rec_bill, $startRow_rec_bill, $maxRows_rec_bill);
$rec_bill = mysql_query($query_limit_rec_bill, $victorphoto) or die(mysql_error());
$row_rec_bill = mysql_fetch_assoc($rec_bill);

if (isset($_GET['totalRows_rec_bill'])) {
$totalRows_rec_bill = $_GET['totalRows_rec_bill'];
} else {
$all_rec_bill = mysql_query($query_rec_bill);
$totalRows_rec_bill = mysql_num_rows($all_rec_bill);
}
$totalPages_rec_bill = ceil($totalRows_rec_bill/$maxRows_rec_bill)-1;

$queryString_rec_bill = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rec_bill") == false &&
stristr($param, "totalRows_rec_bill") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rec_bill = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rec_bill = sprintf("&totalRows_rec_bill=%d%s", $totalRows_rec_bill, $queryString_rec_bill);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<style type="text/css">
<!--
#title {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #660000;
text-decoration: none;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #000000;
}
a {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #660000;
text-decoration: none;
margin-left: 50px;
}
-->
</style>
</head>

<body>
<div id="title">
<a href="#">Bill Board</a>
<a href="#">Paris</a>
<a href="#">Drive IN</a>
<a href="#">Nature</a>
<a href="#">Tennis</a></div>
<p><a href="addrecord.php">Add Records</a> </p>
<p>
<table border="1" align="center">
<tr>
<td>thumb</td>
<td>name</td>
<td>date</td>
</tr>
<?php do { ?>
<tr>
<td> <a href="bill_detail.php?recordID=<?php echo $row_rec_bill['billboardID']; ?>"> <img src="<?php echo $row_rec_bill['thumb']; ?>">&nbsp; </a> </td>
<td> <?php echo $row_rec_bill['name']; ?>&nbsp; </td>
<td> <?php echo $row_rec_bill['date']; ?>&nbsp; </td>
</tr>
<?php } while ($row_rec_bill = mysql_fetch_assoc($rec_bill)); ?>
</table>
<br>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center">
<?php if ($pageNum_rec_bill > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_rec_bill=%d%s", $currentPage, 0, $queryString_rec_bill); ?>">First</a>
<?php } // Show if not first page ?>
</td>
<td width="31%" align="center">
<?php if ($pageNum_rec_bill > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_rec_bill=%d%s", $currentPage, max(0, $pageNum_rec_bill - 1), $queryString_rec_bill); ?>">Previous</a>
<?php } // Show if not first page ?>
</td>
<td width="23%" align="center">
<?php if ($pageNum_rec_bill < $totalPages_rec_bill) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_rec_bill=%d%s", $currentPage, min($totalPages_rec_bill, $pageNum_rec_bill + 1), $queryString_rec_bill); ?>">Next</a>
<?php } // Show if not last page ?>
</td>
<td width="23%" align="center">
<?php if ($pageNum_rec_bill < $totalPages_rec_bill) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_rec_bill=%d%s", $currentPage, $totalPages_rec_bill, $queryString_rec_bill); ?>">Last</a>
<?php } // Show if not last page ?>
</td>
</tr>
</table>
Records <?php echo ($startRow_rec_bill + 1) ?> to <?php echo min($startRow_rec_bill + $maxRows_rec_bill, $totalRows_rec_bill) ?> of <?php echo $totalRows_rec_bill ?> <br>
<p>&nbsp;</p>
<p></body>
</html>
<?php
mysql_free_result($rec_bill);
?>

Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests