Topic: nested repeat region with pagination (Read 594 times)
I crack Photoshop!
Posts: 3
22 credits Members referred : 0
« on: Sep 17, 2007, 10:30:59 AM »
Hello, I'm developing a website that show photos that displays in columns and rows. And for that, I followed a tutorial on nested repeat region - http://www.finalwebsites.com/snippets.php?id=30
It works exactly the way I wanted. Of course I tweak the codes here and there.But now I'm wondering how to add next and previous button to navigate the record. I'm new to PHP. I'm hoping that anyone could help on the continuation of the code I've tried. Help me please anyone?
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6309
38674 credits Members referred : 374
I crack Photoshop!
Posts: 3
22 credits Members referred : 0
« Reply #2 on: Sep 17, 2007, 09:25:21 PM »
Thanks! That was fast. I'm using Dreamweaver to code this. In Dreamweaver, for the record to show, it will need a record name. And my record name is Recordset1. That's why you can see that every action that has '$', there's '_Recordset1'. I'm not sure if that's how it works. But it works when I did that I assume it is equivalent to &result. I'm new in this. Anyway
Here is the top part of the code
<?php require_once('Connections/photo.php'); ?>
<?php $currentPage = $_SERVER["PHP_SELF"];
mysql_select_db($database_photo, $photo); $query_Recordset1 = "SELECT image FROM class ORDER BY id"; $Recordset1 = mysql_query($query_Recordset1, $gift) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1);
$num_cols_Recordset1 = 2; // the number of columns $num_rows_Recordset1 = 3; // the number of rows $num_Recordset1 = 0; // don't change this value, this is the first number of each record inside a record set
I crack Photoshop!
Posts: 3
22 credits Members referred : 0
« Reply #5 on: Sep 18, 2007, 12:38:13 AM »
Okay. Here's my problem. I have code where it sets the record to display in row and columns. I.e :
1 2 3 4 5 6
Which is this code :
<?php require_once('Connections/photo.php'); ?>
<?php $currentPage = $_SERVER["PHP_SELF"];
mysql_select_db($database_photo, $photo); $query_Recordset1 = "SELECT image FROM class ORDER BY id"; $Recordset1 = mysql_query($query_Recordset1, $gift) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1);
$num_cols_Recordset1 = 2; // the number of columns $num_rows_Recordset1 = 3; // the number of rows $num_Recordset1 = 0; // don't change this value, this is the first number of each record inside a record set
?>
And with that the record displays as
1 2 3 4 5 6
But now how do I place a link (next/previous) so it shows 7 to12? I've tried the $max_rows but I don't know how to make it work with to the code above
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6309
38674 credits Members referred : 374
It's time to use PHP5!
« Reply #6 on: Sep 18, 2007, 07:50:28 AM »
check the limit keyword from the mysql manual...
SELECT * FROM tbl LIMIT 5,10;
to Retrieve rows 6-15
replace the first value with the variable $sql_limit