need help so badly...problem in php 5.3

Discussion in 'PHP' started by dracula51, Nov 14, 2009.

  1. #1
    hey.
    i used php 5.2 & recently i upgraded to php 5.3

    i use a pagination class which run fine in php5.2 but its not running php5.3

    plz help me

    here's the class:
    <?
    
    
    class Pagination_class{
    	var $result;
    	var $anchors;
    	var $total;
    	function Pagination_class($qry,$starting,$recpage)
    	{
    		$rst		=	mysql_query($qry) or die(mysql_error());
    		$numrows	=	mysql_num_rows($rst);
    		$qry		 .=	" limit $starting, $recpage";
    		$this->result	=	mysql_query($qry) or die(mysql_error());
    		$next		=	$starting+$recpage;
    		$var		=	((intval($numrows/$recpage))-1)*$recpage;
    		$page_showing	=	intval($starting/$recpage)+1;
    		$total_page	=	ceil($numrows/$recpage);
    
    		if($numrows % $recpage != 0){
    			$last = ((intval($numrows/$recpage)))*$recpage;
    		}else{
    			$last = ((intval($numrows/$recpage))-1)*$recpage;
    		}
    		$previous = $starting-$recpage;
    		$anc = "<ul id='pagination-flickr'>";
    		if($previous < 0){
    			$anc .= "<li class='previous-off'>First</li>";
    			$anc .= "<li class='previous-off'>Previous</li>";
    		}else{
    			$anc .= "<li class='next'><a href='javascript:pagination(0);'>First </a></li>";
    			$anc .= "<li class='next'><a href='javascript:pagination($previous);'>Previous </a></li>";
    		}
    		
    		################If you dont want the numbers just comment this block###############	
    		$norepeat = 4;//no of pages showing in the left and right side of the current page in the anchors 
    		$j = 1;
    		$anch = "";
    		for($i=$page_showing; $i>1; $i--){
    			$fpreviousPage = $i-1;
    			$page = ceil($fpreviousPage*$recpage)-$recpage;
    			$anch = "<li><a href='javascript:pagination($page);'>$fpreviousPage </a></li>".$anch;
    			if($j == $norepeat) break;
    			$j++;
    		}
    		$anc .= $anch;
    		$anc .= "<li class='active'>".$page_showing."</li>";
    		$j = 1;
    		for($i=$page_showing; $i<$total_page; $i++){
    			$fnextPage = $i+1;
    			$page = ceil($fnextPage*$recpage)-$recpage;
    			$anc .= "<li><a href='javascript:pagination($page);'>$fnextPage</a></li>";
    			if($j==$norepeat) break;
    			$j++;
    		}
    		############################################################
    		if($next >= $numrows){
    			$anc .= "<li class='previous-off'>Next</li>";
    			$anc .= "<li class='previous-off'>Last</li>";
    		}else{
    			$anc .= "<li class='next'><a href='javascript:pagination($next);'>Next </a></li>";
    			$anc .= "<li class='next'><a href='javascript:pagination($last);'>Last</a></li>";
    		}
    			$anc .= "</ul>";
    		$this->anchors = $anc;
    		
    		$this->total = "Page : $page_showing <i> Of  </i> $total_page . Total Records Found: $numrows";
    	}
    }
    
    ?>
    PHP:
     
    dracula51, Nov 14, 2009 IP
  2. dracula51

    dracula51 Peon

    Messages:
    146
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    never mind...i hav fixed it....

    at very first i user <? i think u must use <?php in php5.3
     
    dracula51, Nov 14, 2009 IP
  3. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You probably have short-tags set to off then in your php.ini config file, but it's probably better to get used to this anyway because I think they are being removed altogether for PHP 6
     
    wd_2k6, Nov 14, 2009 IP