Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Posts
    243
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Why Is This Not Working Probably Please?

    Alright guys

    I have this membership script that uses the following code to generate another page when a certain limit of products have been added to one page.. That limit is set to 10 on the original script..

    Please see this website http://www.ultimateresalegiveaway.co...t=t&category=1

    If you click on page 2 it changes to another page but nothing is displayed.. Is there something wrong with the code please?

    This is the code for that particular section...

    Code:
    ########## pagination ###########
    	$q = "select count(*) as cnt from ".$prefix."products $cond";
    	$r = $db->get_a_line($q);
    	$count = $r[cnt];
    	if($count == "0")
    		{
    		$warning = "No Results Found";
    		}
    	$records=5;
    	$links="marketplace.php?cat=t&search_txt=$search_txt&";
    	if($page=="")
    		{
    		$page=1;
    		}
    	$start=($page-1)*$records;
    	$Content=$common->print_page_break3($db,$Content,$count,$records,$links,$page);
    	########## pagination ###########
    
    	$ChangeColor = 1;
    	$ToReplace = "";
    	$GetProduct = $db->get_rsltset("select * from ".$prefix."products $cond order by id asc limit $start, $records");
    	for($i = 0; $i < count($GetProduct); $i++)
    		{
    		$bgcolor = "#FFFFFF";
    		@extract($GetProduct[$i]);
    		if($period3_interval == "D"){$interval = "Day(s)";}
    		if($period3_interval == "W"){$interval = "Week(s)";}
    		if($period3_interval == "M"){$interval = "Month(s)";}
    		if($period3_interval == "Y"){$interval = "Year(s)";}
    
    		if($subscription_active == "1")
    			{
    			$salesprice = $amount3." every ".$period3_value." ".$interval;
    			}
    		else
    			{
    			$salesprice = $price;
    			}	
    		$prod_image ='<img src="images/'.$imageurl.'" border="0">';
    		$salespage_link='<a href="prods.php?pid='.$id.'">Click Here For More Information</a>';
    		$ToReplace .= preg_replace($Ptn,"$$1",$SelectedContent);
    		}
    	}	
    		
    $Content = preg_replace($Pat,$ToReplace,$Content);
    $Content = preg_replace("/{{(.*?)}}/e", "$$1", $Content);
    echo $Content;
    include_once ("footer.php");
    ?>

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    The $page variable has to be updated with the value from $_GET['catagory']; I like to use the code snippet below to set the page number.



    PHP Code:
    if(!isset($_GET['catagory'])){
        
    $page 1;
    } else {
        
    $page $_GET['catagory'];
    }

    $start=($page-1)*$records
    Try replacing the code below, with the code above.

    Code:
    if($page=="")
    		{
    		$page=1;
    		}
    	$start=($page-1)*$records;

    -------------
    Last edited by Len Whistler; 01-15-2010 at 03:05 AM.
    Leonard Whistler

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    Or the shorthand code which is
    PHP Code:
    $page = isset($_GET['category']) ? $_GET['category'] : 1;
    $start = ($page 1) * $records
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #4
    Regular Coder
    Join Date
    Dec 2009
    Posts
    243
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Len Whistler View Post
    The $page variable has to be updated with the value from $_GET['catagory']; I like to use the code snippet below to set the page number.



    PHP Code:
    if(!isset($_GET['catagory'])){
        
    $page 1;
    } else {
        
    $page $_GET['catagory'];
    }

    $start=($page-1)*$records
    Try replacing the code below, with the code above.

    Code:
    if($page=="")
    		{
    		$page=1;
    		}
    	$start=($page-1)*$records;

    -------------
    I must be blind.. I cant see the snippet code in the above code supplied..

  • #5
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by Byronwells View Post
    I must be blind.. I cant see the snippet code in the above code supplied..


    ########## pagination ###########
    $q = "select count(*) as cnt from ".$prefix."products $cond";
    $r = $db->get_a_line($q);
    $count = $r[cnt];
    if($count == "0")
    {
    $warning = "No Results Found";
    }
    $records=5;
    $links="marketplace.php?cat=t&search_txt=$search_txt&";
    if($page=="")
    {
    $page=1;
    }
    $start=($page-1)*$records;
    Leonard Whistler

  • Users who have thanked Len Whistler for this post:

    Byronwells (01-16-2010)

  • #6
    Regular Coder
    Join Date
    Dec 2009
    Posts
    243
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Len Whistler View Post
    ########## pagination ###########
    $q = "select count(*) as cnt from ".$prefix."products $cond";
    $r = $db->get_a_line($q);
    $count = $r[cnt];
    if($count == "0")
    {
    $warning = "No Results Found";
    }
    $records=5;
    $links="marketplace.php?cat=t&search_txt=$search_txt&";
    if($page=="")
    {
    $page=1;
    }
    $start=($page-1)*$records;

    Len

    Thank you for your help trying to sort this issue out I have sort of sorted it.. I do have another question.....


  •  

    Posting Permissions

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