28, May 2012

nested repeat region with pagination - webmaster forum

 
Webdigity webmaster forums
[ 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
Instabuck - The easy way to sell digital products online

Author Topic: nested repeat region with pagination  (Read 1673 times)
I crack Photoshop!
*
Posts: 3
22 credits
Members referred : 0


« on: Sep 17, 2007, 09: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: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Sep 17, 2007, 02:47:21 pm »

Hi and welcome at webdigity!

please post your current working code

I crack Photoshop!
*
Posts: 3
22 credits
Members referred : 0


« Reply #2 on: Sep 17, 2007, 08: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: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Sep 17, 2007, 10: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);


?>

Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Sep 17, 2007, 10: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

I crack Photoshop!
*
Posts: 3
22 credits
Members referred : 0


« Reply #5 on: Sep 17, 2007, 11:38:13 pm »

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: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #6 on: Sep 18, 2007, 06: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




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....

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?
May 28, 2012, 09:21:34 pm





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!






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