SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    U.S.
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem of passing the Unique key

    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);
    ?>

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems to be working fine to me....

  3. #3
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    U.S.
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you click on the each thumbnail on http://symphonyimage.com/billboard.php, you will find out the detail page is displaying the same larg photo which is wrong. Please let me know if you have a solution for it.
    Much appreciated.

  4. #4
    SitePoint Wizard Sillysoft's Avatar
    Join Date
    May 2002
    Location
    United States :)
    Posts
    1,691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by begeiste
    If you click on the each thumbnail on http://symphonyimage.com/billboard.php, you will find out the detail page is displaying the same larg photo which is wrong. Please let me know if you have a solution for it.
    Much appreciated.
    You need to show us the code for the page that gets the id

    http://symphonyimage.com/bill_detail.php

    Silly

  5. #5
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    U.S.
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is the code: Thanks.

    <?php require_once('Connections/victorphoto.php'); ?><?php
    $colname_rec_bill = "1";
    if (isset($_GET['billboardID'])) {
    $colname_rec_bill = (get_magic_quotes_gpc()) ? $_GET['billboardID'] : addslashes($_GET['billboardID']);
    }
    mysql_select_db($database_victorphoto, $victorphoto);
    $query_rec_bill = sprintf("SELECT billboardID, LargeImage, name, `date`, `update` FROM billboard WHERE billboardID = %s", $colname_rec_bill);
    $rec_bill = mysql_query($query_rec_bill, $victorphoto) or die(mysql_error());
    $row_rec_bill = mysql_fetch_assoc($rec_bill);
    $totalRows_rec_bill = mysql_num_rows($rec_bill);

    $maxRows_DetailRS1 = 10;
    $pageNum_DetailRS1 = 0;
    if (isset($_GET['pageNum_DetailRS1'])) {
    $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
    }
    $startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;

    mysql_select_db($database_victorphoto, $victorphoto);
    $recordID = $_GET['recordID'];
    $query_DetailRS1 = "SELECT * FROM billboard WHERE billboardID = $recordID";
    $query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
    $DetailRS1 = mysql_query($query_limit_DetailRS1, $victorphoto) or die(mysql_error());
    $row_DetailRS1 = mysql_fetch_assoc($DetailRS1);

    if (isset($_GET['totalRows_DetailRS1'])) {
    $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
    } else {
    $all_DetailRS1 = mysql_query($query_DetailRS1);
    $totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);
    }
    $totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;

    mysql_free_result($DetailRS1);
    ?>
    <div align="center">
    <h3>Bill Board Gallery photos: </h3>
    <p><a href="addrecord.php">Add your record</a><br>
    <a href="billboard.php">Go back to result page
    </a> </p>
    </div>
    <table border="1" align="center">

    <tr>
    <td>billboardID</td>
    <td><?php echo $row_DetailRS1['billboardID']; ?> </td>
    </tr>
    <tr>
    <td>LargeImage</td>
    <td><img src="<?php echo $row_rec_bill['LargeImage']; ?>"> </td>
    </tr>
    <tr>
    <td>name</td>
    <td><?php echo $row_DetailRS1['name']; ?> </td>
    </tr>
    <tr>
    <td>date</td>
    <td><?php echo $row_DetailRS1['date']; ?> </td>
    </tr>
    <tr>
    <td>update</td>
    <td><?php echo $row_DetailRS1['update']; ?> </td>
    </tr>


    </table>
    <?php
    mysql_free_result($rec_bill);
    ?>

  6. #6
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by begeiste
    If you click on the each thumbnail on http://symphonyimage.com/billboard.php, you will find out the detail page is displaying the same larg photo which is wrong. Please let me know if you have a solution for it.
    Much appreciated.
    I know what you mean, but it's not doing that for me. It's showing the right large photo... it's working fine!

    Edit:

    Correction - it was working fine for me at work - it's not working now - now that's really confusing!

  7. #7
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    U.S.
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am sorry. This is really confusing me now since its detail page never get right to match the prime key with billboard.php, that's why I posted these two php codes. Plus I have not touched anything after I posted those thread.

  8. #8
    SitePoint Wizard Sillysoft's Avatar
    Join Date
    May 2002
    Location
    United States :)
    Posts
    1,691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by begeiste
    I am sorry. This is really confusing me now since its detail page never get right to match the prime key with billboard.php, that's why I posted these two php codes. Plus I have not touched anything after I posted those thread.
    Uhh just a long shot but for testing take out:

    mysql_free_result($DetailRS1);

    and then try it

    Silly

  9. #9
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    U.S.
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for this tip. The http://www.symphonyimage.com/billboard.php
    is working, but once clicked on the thumbnail, the detail page large image doesn't match the thumbnail, I still don't know where is the mistake that I made.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •