Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Please Help... Recordset Navigation

New Here ,
Jul 26, 2008 Jul 26, 2008
I am using a PHP/MySQL database to incorporate dynamic data in my website. In particular, I have a gallery of photo thumbnails (the thumbnails are displayed via a Recordset). When clicked on, each thumbnail link opens a pop-up window, which displays the name and full-size image of the record desired. I've tried to insert a Repeated Region server behavior within the pop-up to display one full-size picture at a time and a Recordset navigation bar to click through the different images. However, I can't seem to figure it out.

Operating System: Mac OS X (v10.3)
Web Server: Apache
Browser: N/A
Database type: MYSQL
Application server: PHP
TOPICS
Server side applications
415
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 26, 2008 Jul 26, 2008
Could you post your URL and the relevant PHP code?

Thanks

"mallkj7" <webforumsuser@macromedia.com> wrote in message
news:g6fmnj$kr2$1@forums.macromedia.com...
>I am using a PHP/MySQL database to incorporate dynamic data in my website.
>In
> particular, I have a gallery of photo thumbnails (the thumbnails are
> displayed
> via a Recordset). When clicked on, each thumbnail link opens a pop-up
> window,
> which displays the name and full-size image of the record desired. I've
> tried
> to insert a Repeated Region server behavior within the pop-up to display
> one
> full-size picture at a time and a Recordset navigation bar to click
> through the
> different images. However, I can't seem to figure it out.
>
> Operating System: Mac OS X (v10.3)
> Web Server: Apache
> Browser: N/A
> Database type: MYSQL
> Application server: PHP
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 26, 2008 Jul 26, 2008
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 27, 2008 Jul 27, 2008
Thanks for the link. Nice site design, BTW.

As I can't see the php code, I have to guess at what you are doing in the
background. I don't understand why you need a repeating region in the pop-up
if you're displaying one image at a time. A repeating region would be useful
on the main page to display the thumbnails without hard coding them. (This
is where I can't see what you are doing with php. You might already be doing
this)

Here's the basic approach that I would take; others may have better ideas.
You set up a recordset and tie it to your database, which you've probably
already done as the navigation links seem to work. You select the initial
record based on the ID that you pass to the popup. So all you need to do is
modify your existing popup page to provide a form-based record set control.
This simply posts back to itself with an incremented or decremented ID. You
can get as fancy as you want, from simple buttons, images, Flash, etc.

Is this what you are looking for? If you want to add effects and let someone
else write the code, you might take a look at LightBox or one of the image
library products from PVII.

Lightbox
http://www.lokeshdhakar.com/projects/lightbox2/#download

Project Seven
http://www.projectseven.com/ Look under Graphics Presentation. Whatever you
do, don't tell them that Lightshow Magic looks like Lightbox, or you'll get
an earful, even if they are nearly identical. ;-)

If this is not what you want, or you need help creating the form, please
post a suitably sanitized version of your php code.

HTH

Steve


"mallkj7" <webforumsuser@macromedia.com> wrote in message
news:g6glms$kk9$1@forums.macromedia.com...
> Please see http://kevinmallary.com/Clients/CSA/rides.php.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 28, 2008 Jul 28, 2008
LATEST
Thanks for your advice, Steve! I'm not sure about the form, though. I'm fairly new to PHP...

Here's the PHP code from the thumbnails page:

<?php require_once('../../Connections/CSA.php'); ?>
<?php
mysql_select_db($database_CSA, $CSA);
$query_Rides = "SELECT * FROM Rides ORDER BY id ASC";
$Rides = mysql_query($query_Rides, $CSA) or die(mysql_error());
$row_Rides = mysql_fetch_assoc($Rides);
$totalRows_Rides = mysql_num_rows($Rides);
?>

<table align="center" cellpadding="0" cellspacing="10" style="padding: 5px;">

<tr>

<?php
$Rides_endRow = 0;
$Rides_columns = 6; // number of columns
$Rides_hloopRow1 = 0; // first row flag

do {

if($Rides_endRow == 0 && $Rides_hloopRow1++ != 0) echo "<tr>";
?>

<td>

<a href="display_ride.php?id=<?php echo $row_Rides['id']; ?>" target="_blank" alt="<?php echo $row_Rides['name']; ?>" title="<?php echo $row_Rides['name']; ?>"><img src="pictures/<?php echo $row_Rides['thumb']; ?>" class="ride" /></a></td>

<?php $Rides_endRow++;
if($Rides_endRow >= $Rides_columns) {
?>
</tr>

<?php
$Rides_endRow = 0;
}
}
while ($row_Rides = mysql_fetch_assoc($Rides));
if($Rides_endRow != 0) {
while ($Rides_endRow < $Rides_columns) {
echo("<td> </td>");
$Rides_endRow++;
}

echo("</tr>");
}?>

</table>

<?php
mysql_free_result($Rides);
?>

---------------------------------------------

And here's the code from the popup window:

<?php require_once('../../Connections/CSA.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$colname_current_Ride = "-1";
if (isset($_GET['id'])) {
$colname_current_Ride = $_GET['id'];
}
mysql_select_db($database_CSA, $CSA);
$query_current_Ride = sprintf("SELECT * FROM Rides WHERE id = %s", GetSQLValueString($colname_current_Ride, "int"));
$current_Ride = mysql_query($query_current_Ride, $CSA) or die(mysql_error());
$row_current_Ride = mysql_fetch_assoc($current_Ride);
$totalRows_current_Ride = mysql_num_rows($current_Ride);

$colname_next_Ride = "-1";
if (isset($_GET['id'])) {
$colname_next_Ride = $_GET['id'];
}
mysql_select_db($database_CSA, $CSA);
$query_next_Ride = sprintf("SELECT * FROM Rides WHERE id > %s ORDER BY id ASC", GetSQLValueString($colname_next_Ride, "int"));
$next_Ride = mysql_query($query_next_Ride, $CSA) or die(mysql_error());
$row_next_Ride = mysql_fetch_assoc($next_Ride);
$totalRows_next_Ride = mysql_num_rows($next_Ride);

$colname_previous_Ride = "-1";
if (isset($_GET['id'])) {
$colname_previous_Ride = $_GET['id'];
}
mysql_select_db($database_CSA, $CSA);
$query_previous_Ride = sprintf("SELECT * FROM Rides WHERE id < %s ORDER BY id DESC", GetSQLValueString($colname_previous_Ride, "int"));
$previous_Ride = mysql_query($query_previous_Ride, $CSA) or die(mysql_error());
$row_previous_Ride = mysql_fetch_assoc($previous_Ride);
$totalRows_previous_Ride = mysql_num_rows($previous_Ride);

$queryString_current_Ride = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_current_Ride") == false &&
stristr($param, "totalRows_current_Ride") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_current_Ride = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_current_Ride = sprintf("&totalRows_current_Ride=%d%s", $totalRows_current_Ride, $queryString_current_Ride);
?>

<h1 class="rideTitle" style="position: relative; top: 10px"><?php echo $row_current_Ride['name']; ?></h1>

<area shape="rect" coords="4,3,48,47" href="display_ride.php?id=<?php echo $row_previous_Ride['id']; ?>" id="Previous Ride" name="Previous Ride" />
<area shape="rect" coords="47,3,99,47" href="display_ride.php?id=<?php echo $row_next_Ride['id']; ?>" id="Next Ride" name="Next Ride" />
<area shape="rect" coords="851,3,897,47" href="#" onclick="self.close();" id="Close Window" name="Close Window" />

<img src="pictures/<?php echo $row_current_Ride['image']; ?>" alt="<?php echo $row_current_Ride['image']; ?>" title="<?php echo $row_current_Ride['image']; ?>" class="ride" style="position: relative; top: -15px" />

<!-- Hide the caption <?php echo $row_current_Ride['caption']; ?> -->

<?php
mysql_free_result($current_Ride);

mysql_free_result($next_Ride);

mysql_free_result($previous_Ride);
?>
-------------------------------

Again, I have a decent sense of what to do with PHP, but I'll use any help that I can receive. Thanks!

Kevin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines