6, July 2008

nested repeat region with pagination - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: nested repeat region with pagination
« previous next »
Pages: [1] Print

Author Topic: nested repeat region with pagination  (Read 561 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 Visit through proxy

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: Male
Posts: 6272
38458 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Sep 17, 2007, 03:47:21 PM »

Hi and welcome at webdigity!

please post your current working code


Last blog : 4th of July Lottery from TemplateMonster.com
I crack Photoshop!
*
Posts: 3
22 credits
Members referred : 0


« Reply #2 on: Sep 17, 2007, 09:25:21 PM »

Thanks! That was fast.  Smiley 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  Grin 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

?>


And here is where  it displays my record

<?php
                      echo "<table>\n";

for ($rows = 0; $rows < $num_rows_Recordset1; $rows++) {
    echo "<tr>\n";
   
    for ($cols = 0; $cols < $num_cols_Recordset1; $cols++) {
        if ($num < $totalRows_Recordset1) {
            $titel = mysql_result($Recordset1, $num, "id");
            $description = mysql_result($Recordset1, $num, "image");
            $url = mysql_result($Recordset1, $num, "name");
            echo "<td><b>".$titel."</b><br><img src=".$description."><br><i><a href=\"".$url."\">Click Here</a></i><td>\n";
        } else {
            echo "<td>:*</td>\n";
        }
        $num++;
    }
    echo "</tr>\n";
}
echo "</table>\n";
?>


_______________________

Thanks Again  Smiley
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6272
38458 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Sep 17, 2007, 11:06:13 PM »

just checked the navigation function again (I wrote a year ago)

whats your problem? do you tried the example with the code above?

$sql_limit = (isset($_GET['limit'])) ? $_GET['limit'] : 0;
echo 
navigation_links($sql_limit$totalRows_Recordset110);




Last blog : 4th of July Lottery from TemplateMonster.com
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6272
38458 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Sep 17, 2007, 11:07:40 PM »

just checked the navigation function again (I wrote a year ago)

whats your problem? do you tried the example with the code above?

$sql_limit = (isset($_GET['limit'])) ? $_GET['limit'] : 0;
echo 
navigation_links($sql_limit$totalRows_Recordset110);




you need to use the same limit value in your sql statement

you can try also the more advanced pagination class:
http://www.finalwebsites.com/snippets.php?id=29 Visit through proxy


Last blog : 4th of July Lottery from TemplateMonster.com
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: Male
Posts: 6272
38458 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





Last blog : 4th of July Lottery from TemplateMonster.com
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7129
Tags : nested pagination repeat-region Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: nested repeat region with pagination
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Jul 06, 2008, 07:55:34 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 35.548
Total Topics: 7.348
Total Members: 3.648
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: mybaseballcards

23 Guests, 5 Users online :

12 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.